469,275 Members | 1,802 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,275 developers. It's quick & easy.

How to separate values in a string and compare them?

Hi.

I have a string value which is combination of strings separated by a new line character '\n'.
ie test1 + '\n' + test2 + '\n' + ..............

I want to compare each string ie test1 .. test2 ..etc with the some another string..

plese tell me how this can be done using javascript ?.......reply ..
Feb 22 '08 #1
4 1350
hsriat
1,654 Expert 1GB
Hi.

I have a string value which is combination of strings separated by a new line character '\n'.
ie test1 + '\n' + test2 + '\n' + ..............

I want to compare each string ie test1 .. test2 ..etc with the some another string..

plese tell me how this can be done using javascript ?.......reply ..
Expand|Select|Wrap|Line Numbers
  1. var test =  test1 + '\n' + test2 + '\n' + ..............
  2. var testArray = test.split('\n')
Feb 22 '08 #2
Expand|Select|Wrap|Line Numbers
  1. var test =  test1 + '\n' + test2 + '\n' + ..............
  2. var testArray = test.split('\n')
hi...

thanks for ur reply.. but the code is working fine with hardcoded value.. But when i am tring to implement it with variable the '\n' is not getting splitted ..
so it is comparing the two values along with '\n'..
Feb 22 '08 #3
hsriat
1,654 Expert 1GB
hi...

thanks for ur reply.. but the code is working fine with hardcoded value.. But when i am tring to implement it with variable the '\n' is not getting splitted ..
so it is comparing the two values along with '\n'..
post your code, then I can try...
Feb 22 '08 #4
post your code, then I can try...

Hi .. ok I did it using search method ..thanks
Feb 25 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by darrel | last post: by
8 posts views Thread by stephen | last post: by
3 posts views Thread by mcolson | last post: by
12 posts views Thread by =?Utf-8?B?SnVsaWEgQg==?= | last post: by
Thekid
9 posts views Thread by Thekid | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.