.Net Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - More.Net Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 26th, 2003, 12:25 PM
trueneutral trueneutral is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 21 trueneutral User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Trying to find the value of character

I've been pulling some data from the database, and it's returning a string of 10 characters. (I can't modify the database, so I have to do this programically) If there is no value in the string, it still returns a length 10 string with 10 invisible characters (The data type from the database is Char, and I've tried changing the values to something else, it doesn't work).

I want to try to modify this string as they're coming in. If they contain no numbers, I want to trim the string down to nothing(I've tried .trim(), it doesn't work).

So far, I can't tell what is IN the string at all. It doesn't seem to think it's a Null value, white space, punctuation etc. it seems to think EVERY character is a number even when there is definately is no numbers.

I have tried this code:
Code:

If charAr(1).IsPunctuation(charAr(0)) = True Then Response.Write("We have a Punctuation!<BR>")
If charAr(1).IsWhiteSpace(charAr(0)) = True Then Response.Write("We have a WhiteSpace!<BR>")
If charAr(1).IsSeparator(charAr(0)) = True Then Response.Write("We have a Separator!<BR>")
If charAr(1).IsSurrogate(charAr(0)) = True Then Response.Write("We have a Surrogate!<BR>")
If charAr(1).IsSymbol(charAr(0)) = True Then Response.Write("We have a Symbol!<BR>")
If charAr(1).IsNumber(charAr(0)) = True Then Response.Write("We have a Number!<BR>")
If charAr(1).IsLetter(charAr(0)) = True Then Response.Write("We have a Letter!<BR>")


And it Always returns "We have a number!" no matter what the content of the string may be (including letters).

I have also tried
Code:
If charAr(1).IsNumber(charAr(0)) = True Then
            temp = charAr(1).GetNumericValue(charAr(0))
            If temp >= 0 And temp <= 9 Then Response.Write("We have a Number!<BR>")
        End If


And it still ALWAYS thinks it's a number, even when there is no number in there.

is there any other way to test for what the character IS in this string? Or is there a good way to SHOW me what's in the string so I can create an if statement to ignore those characters?

Thank you, anyone who has suggestions

Last edited by trueneutral : September 26th, 2003 at 01:01 PM.

Reply With Quote
  #2  
Old September 26th, 2003, 11:54 PM
Nem Nem is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 109 Nem User rank is Private First Class (20 - 50 Reputation Level)Nem User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 10
I’ve noticed similar problems when converting from a fixed length string to a .NET string object. Regardless of whether a string is fixed or variable length it should be null terminated (in fact I’m not too sure where .NET is running into problems). To check if the string is empty you should check to see if the first character is the null character (‘\0’). I’ve also noticed string comparison problems with incorrectly converted strings.

Reply With Quote
  #3  
Old October 1st, 2003, 03:46 PM
trueneutral trueneutral is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 21 trueneutral User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hello Nem

Thanks for the reply. I actually got this sorted out for the most part

I should have been using Char instead of charAr(1) like this:

if char.IsPunctuation(charAr(0)) = True Then Response.Write("We have a Punctuation!<BR>")

Once I started doing that, everything started working again. But thanks for the input

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - More.Net Development > Trying to find the value of invisable character

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap