hello
any body knows how can i add a space befor and after any symbol (such as (,) . - ....etc) in a rich text box
Printable View
hello
any body knows how can i add a space befor and after any symbol (such as (,) . - ....etc) in a rich text box
Do you mean like while typing or when you allready have the text and you would like to change it?
i mean if i alredy have the text
VB Code:
Dim i As Long With RichTextBox1 .SelStart = 0 For i = -1 To Len(.Text) .SelStart = .SelStart + 1 .SelText = " " Next i End With
thanks gavio for your fast reply
but this code adds spaces between all letters and i whant to add spaces between the symbols like ? \ . ;
for example if the text was :
Hello, where are you? please (call)
it will be:
Hello , where are you ? please ( call )
:bigyello:
VB Code:
With RichTextBox1 .Text = Replace(.Text, ",", " , ") .Text = Replace(.Text, "?", " ? ") .Text = Replace(.Text, "\", " \ ") .Text = Replace(.Text, ".", " . ") .Text = Replace(.Text, ";", " ; ") .Text = Replace(.Text, "(", " ( ") .Text = Replace(.Text, ")", " ) ") End With
EDIT: Or..
VB Code:
RichTextBox1.Text = Replace(Replace(Replace(Replace(Replace(Replace(Replace(RichTextBox1.Text, _ ",", " , "), "?", " ? "), "\", " \ "), ".", " . "), ";", " ; "), "(", " ( "), ")", " ) ")
Jcis :thumb:
thanks alot thats it ;)
bear in mind you'll lose any formatting if you use jcis's method