PC Review


Reply
Thread Tools Rate Thread

Chars and str.toCharArray

 
 
Davej
Guest
Posts: n/a
 
      13th May 2010
When is it best to convert a string into a character array? I just
need to process some strings but I am concerned and confused by the
multi-language UTF stuff and the inability to use "IF c1=c2" to
compare chars. Thanks.
 
Reply With Quote
 
 
 
 
Martin H.
Guest
Posts: n/a
 
      13th May 2010
Hello Dave,

I just tried it out and I always got both message boxes (even with
Unicode chars) if they had the same value. If they were different
I did not get any message box.

Dim c1 As Char = "1"c
Dim c2 As Char = "1"c
If c1 = c2 Then
MsgBox("Hello, World!")
End If
If c1.Equals(c2) Then
MsgBox("Hi!")
End If

Maybe you could describe the problem you want to solve. This usually
helps us to help you.

Best regards,

Martin
 
Reply With Quote
 
Davej
Guest
Posts: n/a
 
      14th May 2010
On May 13, 4:33*pm, "Martin H." <hk...@gmx.net> wrote:
> Hello Dave,
>
> I just tried it out and I always got both message boxes (even with
> Unicode chars) if they had the same value. If they were different
> I did not get any message box.



Well, I don't know what I was doing. I was seeing "Operator '=' is not
defined for type Char" but now it is working just fine so I must have
been trying to equate the char with a non-char and that is what the
error message was trying to tell me.

I do have a couple of text questions. I am wanting to write an small
editor somewhat like Notepad and although a multi-line textbox almost
seems usable -- it doesn't seem quite right. Is there any other
toolbox item that could be used that would be more aware of the cursor
location, selected areas of text, and the character being typed?
Consider that you might want to define a left and right margin and
have the text positioned and wrapped accordingly? Thanks.
 
Reply With Quote
 
Tom Shelton
Guest
Posts: n/a
 
      14th May 2010
Davej expressed precisely :
> On May 13, 4:33*pm, "Martin H." <hk...@gmx.net> wrote:
>> Hello Dave,
>>
>> I just tried it out and I always got both message boxes (even with
>> Unicode chars) if they had the same value. If they were different
>> I did not get any message box.

>
>
> Well, I don't know what I was doing. I was seeing "Operator '=' is not
> defined for type Char" but now it is working just fine so I must have
> been trying to equate the char with a non-char and that is what the
> error message was trying to tell me.
>
> I do have a couple of text questions. I am wanting to write an small
> editor somewhat like Notepad and although a multi-line textbox almost
> seems usable -- it doesn't seem quite right. Is there any other
> toolbox item that could be used that would be more aware of the cursor
> location, selected areas of text, and the character being typed?
> Consider that you might want to define a left and right margin and
> have the text positioned and wrapped accordingly? Thanks.


RichTextbox...

--
Tom Shelton


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
TrimEnd with ToCharArray =?Utf-8?B?Sm9obk1TeXJhc29mdA==?= Microsoft Dot NET 3 25th Apr 2007 01:18 PM
How to read a text file populated by multi-byte chars(e.g. Chinese chars )? Peter Microsoft VB .NET 0 1st Nov 2006 02:26 PM
Russian chars where should be spanish chars Jorge Andres Brugger Windows XP General 0 27th Sep 2006 01:30 PM
newbie: ToCharArray() problems Jeff Microsoft C# .NET 3 26th Jun 2005 08:15 PM
A bug in String.ToCharArray? Michael Barnes Microsoft C# .NET 6 24th Sep 2003 11:52 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:57 PM.