(data string)
| 196 | } |
| 197 | |
| 198 | func UnitstrConvert(data string) string { |
| 199 | if data == "" { |
| 200 | return data |
| 201 | } |
| 202 | // no unit case |
| 203 | // Multiple UNISTR function calls maybe concatenated together using "||". |
| 204 | // We split the values into their respective parts before parsing each one separately. |
| 205 | regex, err := regexp.Compile(CONCATENATIONPATTERN) |
| 206 | if err != nil { |
| 207 | return "" |
| 208 | } |
| 209 | parts := regex.Split(data, -1) |
| 210 | results := make([]string, len(parts)) |
| 211 | for i := range parts { |
| 212 | trimPart := strings.TrimSpace(parts[i]) |
| 213 | if isUnistrFunction(trimPart) { |
| 214 | results = append(results, UnitstrDecode(trimPart[7:len(trimPart)-1])) |
| 215 | } else { |
| 216 | results = append(results, data) |
| 217 | } |
| 218 | } |
| 219 | return strings.Join(results, "") |
| 220 | } |
| 221 | |
| 222 | func UnitstrDecode(value string) string { |
| 223 | strconv.ParseInt(value, 10, 16) |
no test coverage detected