Home / Docs / Download / Release Note / Blog / ImageTrans / Support / Donation / RSS
1.2 beta3
The major update is to improve how BasicCAT remove redundant spaces for non-space-delimited languages likes Japanese and Chinese.
The added code:
Sub removeSpacesAtBothSides(path As String,targetLang As String,text As String,removeRedundantSpaces As Boolean) As String
readRules(targetLang,path)
Dim breakRules As List=rules.Get("breakRules")
Dim breakPositions As List
breakPositions=getPositions(breakRules,text)
breakPositions.Sort(False)
removeDuplicated(breakPositions)
For Each position As Int In breakPositions
Try
Dim offsetToRight As Int=0
For i=0 To Max(text.Length-1-position,0)
If position+i<=text.Length-1 Then
If text.CharAt(position+i)=" " Then
offsetToRight=offsetToRight+1
Else
Exit
End If
End If
Next
Dim rightText As String
If position+offsetToRight<=text.Length-1 Then
rightText=text.SubString2(position+offsetToRight,text.Length)
End If
text=text.SubString2(0,position)&rightText
Catch
Log(LastException)
End Try
Next
If removeRedundantSpaces Then
text=Regex.Replace2("\b *\B",32,text,"")
text=Regex.Replace2("\B *\b",32,text,"")
End If
Return text
End Sub
© 2024 BasicCAT ― Powered by Jekyll and Textlog theme