Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

How to escape periods in Super Strings

Hi, I am trying to figure out how to properly escape periods (.) in Super Strings.

Example 1

This works as expected:


name = "Angelo"
greeting = "Hello, $name."

But this does not work:


networkID = "199.188.1"
hostID = "22"
myIP = `$networkID.$hostID`

Example 2


jsonProperty = 'people_array'
itemIndex = 4
nameProperty = 'name_full_with_middle_init'

This works:


jsonPath_noSuperStr = jsonProperty : '.' : itemIndex : '.' : nameProperty

But this does not:


jsonPath_yesSuperStr = `$jsonProperty.$itemIndex.$nameProperty`

Note: When I say "does not work," I mean it throws a "Variable not assigned to a value" runtime error.

Is there a proper way to escape or handle periods inside Super Strings?

Thanks you!

Comments

  • No idea what Super Strings are, so, chatgpt says:

    In OpenInsight SuperStrings, a period (.) is treated as a wildcard/special character, so to match a literal period you escape it with a backslash:
    "\."
    Example:
    ss = "file\.txt"
    This matches the literal text:
    file.txt
    rather than:
    filextxtfile1txt
    If you are writing the pattern inside a BASIC+ string, you may sometimes need to double the backslash depending on context:
    "file\\.txt"
    That’s because BASIC+ processes the first backslash before SuperStrings sees it.
  • I moved this discussion into the SRP Utilities channel since this is the right place.

    Barry - Super Strings are part of our precompiler feature set which is included in the SRP Utilities.

    Angelo - We've seen areas where special characters being juxtaposed close to each other can cause problems. We've resolved all the ones that we've come across. I need to test to see if your situation is reproducible. Can you confirm the version of the SRPUtilities.dll file in your OI folder?

Sign In or Register to comment.