B4J Question Get parameter

aaronk

Well-Known Member
Licensed User
Hi,

I have a string and I am trying to get split part of it..

My string is: ...?page=abc123

I am trying to get just the abc123 part of the string.
(The ... at the start of the string can change so I can't really use the substring function)

Anyone know how to do this ?
 

rboeck

Well-Known Member
Licensed User
Look for the position of "?page=" with

B4X:
Po = String.IndexOf("?page=") + 6 ' Len of Searchstring
NewString=String.SubString(Po)
 

inakigarm

Well-Known Member
Licensed User
If abc123 is always there (at the end of string) is easy, you've to code a right function with substring or use Right with jstringfunction taking 6 characters long from string (abc123)
 

aaronk

Well-Known Member
Licensed User
Hi,

I think I have worked it out and I think this code is going to work:

B4X:
Dim mystring As String = "pageid=abc123"
    Dim parameter() As String = Regex.Split("pageid=", mystring)  
    Log(parameter(1))
 
Top