B4J Question Get parameter

Discussion in 'B4J Questions' started by aaronk, May 23, 2015.

  1. aaronk

    aaronk Well-Known Member Licensed User


    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 ?
  2. rboeck

    rboeck Well-Known Member Licensed User

    Look for the position of "?page=" with

    Po = String.IndexOf("?page=") + 6 ' Len of Searchstring
  3. inakigarm

    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)
  4. narek adonts

    narek adonts Well-Known Member Licensed User

    Is this a url post for php script?
  5. aaronk

    aaronk Well-Known Member Licensed User


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

    Dim mystring As String = "pageid=abc123"
    Dim parameter() As String = Regex.Split("pageid=", mystring)  
  6. Erel

    Erel Administrator Staff Member Licensed User

    If you are implementing a server then you can use req.GetParameter.
  7. aaronk

    aaronk Well-Known Member Licensed User

    I just tried that and it worked perfect!
    Thanks heaps
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice