Advertisement

05.20.2008 at 09:16AM PDT, ID: 23417803
[x]
Attachment Details

Get next character in substring if string matches another string

Asked by saturation in JavaScript

Tags: ,

I am looping through some text and need to compare text with text from another string to see if it matches anywhere in that string, and if it does, get the next character in the text, compare again, and if it is unique, store that as a separate variable.  Here's what I have so far:

var sComplete = ""
for (i=2; i < 30; i ++) {
  sPrefix = String(xlsSheet.Range("B" + i).substring(0,4));
  if (sComplete.indexOf(sPrefix) > 0) {
  // get next character (so replace the fourth character with the fifth)

  // compare that string against sComplete

  }
  sComplete +=  sPrefix + ", ";
}Start Free Trial
 
 
[+][-]05.20.2008 at 03:06PM PDT, ID: 21610783

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: JavaScript
Tags: Java Script, IE 7.0
Sign Up Now!
Solution Provided By: ysfx
Participating Experts: 1
Solution Grade: A
 
 
[+][-]07.12.2008 at 12:14AM PDT, ID: 21988008

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]07.16.2008 at 08:51PM PDT, ID: 22022255

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628