I want to sent a string as an argument to a function. But some user may enter maybe 100 size string or even larger.
[Q] Inside the function is it possible to check the size of the string and return false if it exceeds the length limit that I have specified.
For example, a user is only allowed to send string which has length of 64 characters, and the contract's function returns throw if the string exceeds the limit of 64 character.
Test.transaction().setVariable("very_large_size_string_entered_65_chars");
For example:
Contract Test{
String data;
function setVariable(string str) {
//check somehow does the string exceeds the character limit.
data = str;
}
}
Thank you for your valuable time and help.
TypeError: Operator == not compatible with types bytes1 and int_const 6on the lineelse if (string_rep[i]>>5==0x6)– Chris_77 Jan 11 '22 at 07:38