Zum Hauptinhalt gehen



VB script: find CHARACTER in string


1 Kommentar

  • Avatar
    Peter Thane

    You need to use the InStr command to search for the ; and then take the location of the 1st instance of the semicolon away from the length of the full original string and then just keep the portion of that, such as 

    Depending on where your data is coming from (ie if from a Database or a Data Entry Form field) then you may need to make the VB field and Event Controlled Script and process the VB at the appropriate time, such as OnNewRecord if from a database etc. 

    For the example above, to show it working for both string lengths, I added both text strings on to the label and made them Named Datasources (string1 and string2) so I could reference them more easily for the VB. The VB I used is as follows, for string2:

    Value = Format.NamedSubStrings("string2").Value

    Value1 = Len(Value)

    Value2 = Instr(1,Value,";",0)

    Value1 = Value1-Value2

    Value = Right(Value,Value1)



Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.