eric.dizon
25th June 2014, 22:20
I am trying to create a function that strips a MB string of the Chinese characters or any non-alphanumeric characters in a string. How can I best achieved this? I am trying to use the following function str.containsMBchar but it doesn't seem to work? Any work around with what I need to achieve?

Syntax:
function boolean str.containsMBchar (const string string$)

Description

Tests whether the specified string contains at least one multi byte character. It does not matter if the string to search in is declared as a single byte or a multi byte string.


Arguments
const string string$ a string


Return values
true string$ contains at least one multi byte character
false in any other case

Context
This function is implemented in the 4GL Tools and can be used in all script types. This function is available from TIV level 1700.

osofusion
11th September 2015, 17:27
could you share the code please?

GaryEd
11th September 2015, 21:10
No idea in baan but i did something similar in Excel.

User defined function for Excel to count number of non-ascii characters in a cell
In Excel
1. Press <Alt> + <F11> to open VBA editor
2. Insert new module
3. Paste following text
Function bt_255(s As String) As Long
Dim j As Long, iCode As Integer

For j = 1 To Len(s)
iCode = AscW(Mid(s, j, 1))
If iCode < 0 Or iCode > 255 Then bt_255 = bt_255 + 1
Next j
End Function
4. To use in Excel workbook enter as formula “=bt_255(A1)”

bhushanchanda
12th September 2015, 11:14
Can you elaborate your requirement?

You can use mb.export$() and mb.import$() functions to handle MB strings.