comp • gb.util • string • tophonetic

String.ToPhonetic (gb.util)

Static Function ToPhonetic ( String As String [ , Language As String ] ) As String

Return a phonetic representation of a string.

  • String : The string to transform.

  • Language : The language of the string. By default, it is supposed to be the current language as defined by System.Language.

The algorithm is the following:

  • The string is stripped into words.

  • A word is composed of any successive alphanumeric characters. Any other character is ignored and considered as word delimiter.

  • Each word is transformed by a specific algorithm that depends on the language.

  • A word with only digits is returned as is, enclosed with parenthesis.

  • The result returned is the list of all transformed words joined with spaces.

At the moment only the French language is supported.

The French algorithm is an adaption of the soundex algorithm depicted here:


Use "gb.util"
Print String.ToPhonetic("Notre père qui êtes aux Cieux", "fr_FR")
Print String.ToPhonetic("Le silence éternel de ces espaces infinis m’effraie", "fr_FR")
Print String.ToPhonetic("On n’a pas besoin de lumière, quand on est conduit par le Ciel", "fr_FR")
notre pyre ki yte o sie
le sil1se ytyrnel de se espase 4fini m efrye
on n a pa beso4 de lumiyre k1 on es kondui pa le siel