跳转到主内容

//ERDDAP/com.cohort.util/ScriptString2/simpleMatlabNameSafe

simpleMatlabNameSafe

[JVM]
open fun simpleMatlabNameSafe(s: String): String

This is like encodeMatlabNameSafe, but simpler and won't always retain all the info.

  • first character must be A-Z, a-z.
  • subsequent characters must be A-Z, a-z, _, 0-9.

non-safe characters are some safe variant. See posix fully portable file names at https://en.wikipedia.org/wiki/Filename . When the encoding is more than 25 characters, this stops encoding and adds "xh" and the hash code for the entire original string, so the result will always be less than ~41 characters. This meets MatLab restrictions: https://www.mathworks.com/help/matlab/ref/matlab.lang.makevalidname.html

THIS WON'T BE CHANGED. SOME datasetIDs DEPEND ON SAME ENCODING OVER TIME.

Return

s with all of the non-variableNameSafe characters changed. If s is null, this returns "null_". If s is "", this returns "nothing_".

Parameters

JVM

s