Solved

Position of Charater in string

Posted on 2009-04-06
2
250 Views
Last Modified: 2012-05-06
we have a product that uses Javascript to produce dashboard information running on websphere 6,

i'm looking at a way of returning the day name / number 1-7 from a string of charaters,
I have a string that would contain 7 charaters similar to this 'NNYNNNN' the 'Y' means we deliver to this customer on Wednesday so i need to return '3'  i can do a case ect to trun into wednsday. problem is there can be more than one 'Y' so there would be to many combinations to do in if statements,

in VB i would use indexof,

is there a similar function in javascript?
0
Comment
Question by:IanPaskin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 27

Expert Comment

by:rrz
ID: 24077470
>is there a similar function in javascript?  
Do you mean JSP  ?     If yes, then  you could use something like  
<%
     String s = "NNYNNNN";
     if(s.charAt(2) == 'Y') out.print("yes");
     else out.print("no");
%>
0
 
LVL 27

Accepted Solution

by:
rrz earned 250 total points
ID: 24077677
Javascript is similar. use this test  page

<script>
  function test(){
          var s = "NNYNNNN";
          if(s.charAt(2) == 'Y') alert("yes");
          else alert("no");
  }
</script>
<html>
<body onload="test();">
</body>
</html>
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After hours on line I found a solution which pointed to the inherited Active Directory permissions . You have to give/allow permissions to the "Exchange trusted subsystem" for the user in the Active Directory...
CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decadeā€¦

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question