Här kommer en liten kodsnutt man kan använda i Inobiz för att filtrera bort oönskade tecken i ett edifactmeddelande:
/* input = string to process, charset = charset to use (unoa, unob, unoc) mode = alphanumeric or numeric (an, n) length = length of resulting string (including decimals) decimals = number of decimals (only used when mode == "n") */ string EdiString (string input, string charset, string mode, integer length, integer decimals) { string regex, schar, editmask; if (mode == "n") { if (decimals > 0) editmask = "-" & fill ("Z", length - (decimals + 2)) & "9P" & fill("9", decimals); else editmask = "-" & fill ("Z", length - 1) & "9"; input = removechars(edit(input, editmask), "+"); } else { if (tolower(charset) == "unoa") { regex = "[^0-9A-Z.,_()\\/=\\\\\\+:?\"!'%&*;<> ]"; input = translate(input, "åäöÅÄÖ", "aaoAAO"); input = toupper(input); } else if (tolower(charset) == "unob") { regex = "[^0-9A-Z.,_()\\/=\\\\\\+:?\"!'%&*;<> a-z]"; input = translate(input, "åäöÅÄÖ", "aaoAAO"); } else /* defaulfs to unoc */ regex = "[^0-9a-z.,_()\\/=\\\\\\+:?\"!'%&*;<> A-ZåäöÅÄÖ]"; for (integer i = 1; i < strlen(input) ; ++i) { schar = strpos (input, i); if (regexp(schar, regex) == 1) { input = removechars(input, schar); } } if (strlen(input) > length) input = substr(input, 1, length); } return input; }