VB Script

If var="a1bc23"->separate this string into two strings like, abc, 123

Questions by prash036   answers by prash036

Showing Answers 1 - 6 of 6 Answers

ratna

  • Jun 29th, 2012
 

Code
  1. dim a,x

  2. a="ab1c23"

  3. for i=1 to len(a)

  4. if asc(mid(a,i,1))<>32 then

  5. if asc(mid(a,i,1))>=97 and asc(mid(a,i,1))<=122 and asc(mid(a,i,1))>=65 and asc(mid(a,i,1))<=90 then

  6. mystring=mystring&mid(a,i,1)

  7. else

  8. if asc(mid(a,i,1))>=48 and asc(mid(a,i,1))<=57 then

  9. mynumber=mynumber&mid(a,i,1)

  10. end if

  11. end if

  12. end if

  13. next

  14. msgbox (mystring)

  15. msgbox (mynumber)

  Was this answer useful?  Yes

SatishRaja

  • Aug 6th, 2013
 

Code
  1. var="a1bc23"

  2. x=len(var)

  3. For i= 1 to x

  4.         a=mid(var,i,1)

  5.         If IsNumeric(a) then

  6.                 myNumber=myNumber+a

  7.         Else

  8.                 myString=myString+a

  9.         End If

  10. Next

  11. MsgBox myString

  12. MsgBox myNumber



Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions