[Gambas-user] Function Len in gambas2

Charlie Reinl Karl.Reinl at ...9...
Thu Apr 2 00:18:36 CEST 2009


Am Mittwoch, den 01.04.2009, 23:46 +0300 schrieb vlahonick vlahonick:
> 
> 
> > From: Karl.Reinl at ...9...
> > To: gambas-user at lists.sourceforge.net
> > Date: Wed, 1 Apr 2009 22:14:47 +0200
> > Subject: [Gambas-user] Function Len  in gambas2
> > 
> > Salut,
> > 
> > am I wrong? but I think thats use for nothing as LEN works actually in
> > gambas2
> > 
> > from .....gambas2/help/help/lang/len.html
> > 
> > Len
> > Syntax
> > iLength = Len ( sArg AS String ) AS Integer
> > 
> > Returns the byte count which is occupied by the String sArg. Each ASCII
> > character which has the code 0 to 127 requires one byte, UTF-8
> > characters as äöüß require two or more bytes.
> > 
> > Examples
> > PRINT Len("Gambas"), Len("äöü")
> > <hr>6       6
> > PRINT Len("")
> > 0
> > 
> > See also
> > String Functions 
> > 
> > for what good that for?
> > 
> > -- 
> > Amicalment
> > Charlie
> 
> 
> hi again...sorry about the delay in my reply :D
> but i really didnt understand ur example here....
> of course now i realise that even the textbox2.text had the reasult i wanted the problem will
> be in the letters appering because of their bytes...
> but the main problem is not solved yet....
> still in the textbox2.text appears what i am writing in the textbox1.text and not what i want...
> and abou the example u gave me with if then else end if is a bad idea because if for example we want to
> converter a word i have to put many boxes and the user to write a letter in every box to have in that many other boxes a result....
> (anyway i tried this but just didnt work...)
> so plz if u can tell me how i can make with two boxes every character i wrote in the first box to appear what i want in the second box....
> what i wrote wrong???why at the 2nd box appears what i am writing in the 1st box???
> plz solve this and then if this problem is solved but in the second or first textbox the charactes doesnt appears in the way the should i will try to set somehow that they are UTF-8 characters so they have more bytes...
> ty again for ur replies :D:D:D
> 
> vlahonick...LOVE AND GREETINGS FROM GREECE :D
> also u can see some of my work in the www.vlahonick.freehost.gr (of course u dont gonna understand many because site is in greek but u can try download my games->www.vlahonick.freehost.gr/downloads.html and press Παιχνίδια=games)
> 
> here my code for one more time :
> 
> ' Gambas class file
> 
> PUBLIC SUB _new()
> 
> END
> 
> PUBLIC SUB Form_Open()
> 
> END
> 
> PUBLIC SUB Button1_Click()
> DIM nI AS Integer
> DIM sAnyChar AS String
> TextBox2.text = ""
>    FOR nI = 1 TO Len(TextBox1.Text)
>       sAnyChar = Mid(TextBox1.Text, nI, 1)
>       TextBox2.Text = TextBox2.Text & Gronverter(sAnyChar)
>    NEXT 
> END
> 
> FUNCTION Gronverter(sInChar AS String) AS String
> DIM sRetChar AS String = sInChar
> 
> IF sInChar = "α" THEN sRetChar = "a"
> IF sInChar = "β" THEN sRetChar = "v"
> IF sInChar = "γ" THEN sRetChar = "g"
> IF sInChar = "δ" THEN sRetChar = "d"
> IF sInChar = "ε" THEN sRetChar = "e"
> IF sInChar = "ζ" THEN sRetChar = "z"
> IF sInChar = "η" THEN sRetChar = "ι"
> IF sInChar = "θ" THEN sRetChar = "th"
> IF sInChar = "ι" THEN sRetChar = "i"
> IF sInChar = "κ" THEN sRetChar = "k"
> IF sInChar = "λ" THEN sRetChar = "l"
> IF sInChar = "μ" THEN sRetChar = "m"
> IF sInChar = "ν" THEN sRetChar = "n"
> IF sInChar = "ξ" THEN sRetChar = "x"
> IF sInChar = "ο" THEN sRetChar = "o"
> IF sInChar = "π" THEN sRetChar = "p"
> IF sInChar = "ρ" THEN sRetChar = "r"
> IF sInChar = "σ" THEN sRetChar = "s"
> IF sInChar = "τ" THEN sRetChar = "t"
> IF sInChar = "υ" THEN sRetChar = "i"
> IF sInChar = "φ" THEN sRetChar = "f"
> IF sInChar = "χ" THEN sRetChar = "h"
> IF sInChar = "ψ" THEN sRetChar = "ps"
> IF sInChar = "ω" THEN sRetChar = "o"
> RETURN sRetChar
> 
> END
> 
> PUBLIC SUB Button2_Click()
> 
>   TextBox1.text = ""
>   TextBox2.text = ""
> END

Salut,

Dominique Simonart has the UTF-8 Solution for your problem.

PS: the origin of mail was not the answer to your questions
-- 
Amicalment
Charlie





More information about the User mailing list