What I am trying to do is replace the “-” in this string with “-2d”. So I have a string “my-site-location” I want it to look like “my-2dsite-2dlocation”. I’ve looked through the relevance guide and this forum and was not able to find an easy way to do this.
The reason I need this is because we are writing a script to subscribe computers with a property value to a custom site, but with the custom sites, you need to change these special character’s around.
If you know the full length of the string you can do something like this to swap x with z:
concatenation of ((first 16 of it; “z”; last 3 of it) of “1234567890123456x890”)
Also, for your amusement, here is a really ugly way to do the same thing with regex:
concatenation of ((parenthesized parts (1) of matches (regex “^(…)(.)(.)") of it; “z”; parenthesized parts (3) of matches (regex "^(…)(.)(.)”) of it) of “1234567890123456x890”)
Im trying to convert the following string from “Version 15 Release 5 Level 0.0” to “15.5.0.0” so that I can evaluate it as a version and compare it if it is >= “15.5.1.100”
q: concatenation “.” of (it as string) of (it as floating point | “999” as floating point) whose (it != “999” as floating point) of substrings separated by " " of “Version 15 Release 5 Level 0.0”
A: 15.5.0.0
The idea is:
Take everything apart separated by space or spaces
Identify the digit by casting to float points. If it fails, it is not a digit