跳转到主内容

//ERDDAP/com.cohort.util/ScriptString2/encodeFileNameSafe

encodeFileNameSafe

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

This is different from String2.modifyToBeFileNameSafe -- this encodes non-fileNameSafe characters so little or no information is lost. This returns the string with just file-name-safe characters (0-9, A-Z, a-z, _, -, .). 'x' and non-safe characters are CONVERTED to 'x' plus their 2 lowercase hexadecimalDigit number or "xx" + their 4 hexadecimalDigit number. 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 WON'T BE CHANGED. FILE NAMES CREATED FOR EDDGridCopy and EDDTableCopy DEPEND ON SAME ENCODING OVER TIME.

Return

s with all of the non-fileNameSafe characters changed. If s is null, this returns "x-1". If s is "", this returns "x-0".

Parameters

JVM

s