2

I have a string that is returned, that contains data separated by |'s.

I already have my script splitting by a '|', now I just need to count how many pieces of data are stored in the string, easiest way I see it would be to count the number of |'s in the string.

This is basically what's going on so far: http://jsfiddle.net/53ueL/

Greatly appreciate any help in advance!

1
  • you're never incrementing "i"? Commented Mar 9, 2011 at 15:45

2 Answers 2

5

I might be missing something, but I it looks like you can just do:

$(".Count").html(TOElist.length);
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! I didn't even think about taking the length of that. Really appreciate your help :)
1

Why not simply get the length of the array you've split everything into?

$(".Count").html(TOElist.length);

http://jsfiddle.net/53ueL/1/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.