1

How can I split a string using vbscript?

Dim personal_number
Dim personal_prefix

person_prefix = Split(personal_number, 4)

I want to split person_prefix and grab the first four characters. Is this the correct approach because it seems to return the entire string on document.write.

2
  • What if I want to grab '25' out of '10253940'. The numbers between 10 and 3940? Commented Sep 12, 2013 at 7:59
  • I solved it by first doing a person_prefix = Left(personal_number, X) and then another Left or Right to grab what I want. Commented Sep 12, 2013 at 8:43

1 Answer 1

3

To return the first four characters use person_prefix = Left(personal_number, 4) instead.

(String splitting breaks up a string into an array using a supplied delimiter: not relevant in your case).

Sign up to request clarification or add additional context in comments.

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.