Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save trycf/76becc77bfd87c7a68c84a6cb2db4260 to your computer and use it in GitHub Desktop.
Save trycf/76becc77bfd87c7a68c84a6cb2db4260 to your computer and use it in GitHub Desktop.
TryCF Gist
<cfscript>
test = "abc" & chr(0) & "xyz" & chr(0) & "123";
writedump(test);
writedump( len(test) );
writedump( find(chr(0), test) ); // value=1 => NULL char is still there, and Lucee is tell you it is on position 1 which is wrong
writeoutput("<hr>");
result = replace(test, chr(0), "", "all");
writedump(result);
writedump( len(result) );
writedump( find(chr(0), result) ); // value=1 => NULL char is still there, and Lucee is tell you it is on position 1 which is wrong
writeoutput("<hr>");
result = createObject("java", "java.lang.String").init(test);
result = result.replaceAll(chr(0), "");
writedump(result);
writedump( len(result) );
writedump( find(chr(0), result) ); // value=1 => NULL char is still there, and Lucee is tell you it is on position 1 which is wrong
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment