473,486 Members | 1,889 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Data Values

I am using the following to gwt the return value from the serial port
"mabtRxBuf"

I declare my STRdata as a global string and when the code is executed
I get the following for the STRdata

STRdata = "0.10[]" how can i get rid of the [] in my string?
Dim enc As New System.Text.ASCIIEncoding
STRdata = enc.GetString(mabtRxBuf)
Aug 26 '08 #1
6 1070
This will replace all instances of "[]" with "" in your string.

STRdata = Replace(STRdata, "[]", "")

"cmdolcet69" <co************@hotmail.comwrote in message
news:84**********************************@z72g2000 hsb.googlegroups.com...
I am using the following to gwt the return value from the serial port
"mabtRxBuf"

I declare my STRdata as a global string and when the code is executed
I get the following for the STRdata

STRdata = "0.10[]" how can i get rid of the [] in my string?
Dim enc As New System.Text.ASCIIEncoding
STRdata = enc.GetString(mabtRxBuf)

Aug 26 '08 #2
"cmdolcet69" <co************@hotmail.comschrieb:
>I am using the following to gwt the return value from the serial port
"mabtRxBuf"

I declare my STRdata as a global string and when the code is executed
I get the following for the STRdata

STRdata = "0.10[]" how can i get rid of the [] in my string?
Dim enc As New System.Text.ASCIIEncoding
STRdata = enc.GetString(mabtRxBuf)
Does the string really end with the characters "[]" or is the last character
displayed as a rectangle glyph? If the latter is the case, what's the
character code of the last character? You could use
'String.Left'/'String.Substring' to extract a part of the string.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Aug 26 '08 #3
Maybe you could try this - see if it works:

Dim enc As New System.Text.ASCIIEncoding
STRdata = enc.GetString(mabtRxBuf).Replace("[]", "")

As long as this is text data - you should be able to parse out the [].

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Aug 26 '08 #4
On Aug 26, 4:53 pm, "Herfried K. Wagner [MVP]" <hirf-spam-me-
h...@gmx.atwrote:
"cmdolcet69" <colin_dolce...@hotmail.comschrieb:
I am using the following to gwt the return value from the serial port
"mabtRxBuf"
I declare my STRdata as a global string and when the code is executed
I get the following for the STRdata
STRdata = "0.10[]" how can i get rid of the [] in my string?
Dim enc As New System.Text.ASCIIEncoding
STRdata = enc.GetString(mabtRxBuf)

Does the string really end with the characters "[]" or is the last character
displayed as a rectangle glyph? If the latter is the case, what's the
character code of the last character? You could use
'String.Left'/'String.Substring' to extract a part of the string.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
You are correct it is the last character displayed in the "" how can I
get ride of any character [] in my string
Aug 27 '08 #5
On Wed, 27 Aug 2008 05:15:37 -0700 (PDT), cmdolcet69
<co************@hotmail.comwrote:
>On Aug 26, 4:53 pm, "Herfried K. Wagner [MVP]" <hirf-spam-me-
h...@gmx.atwrote:
>"cmdolcet69" <colin_dolce...@hotmail.comschrieb:
>I am using the following to gwt the return value from the serial port
"mabtRxBuf"
I declare my STRdata as a global string and when the code is executed
I get the following for the STRdata
STRdata = "0.10[]" how can i get rid of the [] in my string?
Dim enc As New System.Text.ASCIIEncoding
STRdata = enc.GetString(mabtRxBuf)

Does the string really end with the characters "[]" or is the last character
displayed as a rectangle glyph? If the latter is the case, what's the
character code of the last character? You could use
'String.Left'/'String.Substring' to extract a part of the string.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

You are correct it is the last character displayed in the "" how can I
get ride of any character [] in my string
If str.EndsWith("[]" Then
' Get rid of last two chars if they are []
str = str.Substring(0, str.Length-2)
End If

or

' Get rid of all occurences of []
str = str.Replace("[]", "")
Aug 27 '08 #6
The box represents a non-ascii character in the string, probably a line feed
or carriage-return. Use StrData.Length to confirm that the string is
actually one character longer than the ASCII characters you can see. If it
is consistently one character longer than it should be then use the
substring method to extract everything except the last character.

STRdata = STRdata.substring(0, STRData.length - 1)

Depending on the contents of the string, you might be able to use

STRdata = STRdata.TrimEnd(Nothing)

"cmdolcet69" <co************@hotmail.comwrote in message
news:f6**********************************@y38g2000 hsy.googlegroups.com...
On Aug 26, 4:53 pm, "Herfried K. Wagner [MVP]" <hirf-spam-me-
h...@gmx.atwrote:
>"cmdolcet69" <colin_dolce...@hotmail.comschrieb:
>I am using the following to gwt the return value from the serial port
"mabtRxBuf"
I declare my STRdata as a global string and when the code is executed
I get the following for the STRdata
STRdata = "0.10[]" how can i get rid of the [] in my string?
Dim enc As New System.Text.ASCIIEncoding
STRdata = enc.GetString(mabtRxBuf)

Does the string really end with the characters "[]" or is the last
character
displayed as a rectangle glyph? If the latter is the case, what's the
character code of the last character? You could use
'String.Left'/'String.Substring' to extract a part of the string.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

You are correct it is the last character displayed in the "" how can I
get ride of any character [] in my string
Aug 27 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3914
by: Simon | last post by:
Hi, I am having a little problem with my PHP - MySQl code, I have two tables (shown below) and I am trying populate a template page with data from both. <disclaimer>Now I would like to say my...
5
2015
by: Alexandre | last post by:
Hi, Im a newb to dev and python... my first sefl assigned mission was to read a pickled file containing a list with DB like data and convert this to MySQL... So i wrote my first module which...
1
1665
by: Diego Buendia | last post by:
I'm facing the next problem: I have a table with two columns (among others) modeling category and subcategory data for each row. I need to summarize info on this two columns, but with the next...
7
3902
by: mittal.pradeep | last post by:
What is the better table design for a data collection application. 1. Vertical model (pk, attributeName, AttributeValue) 2. Custom columns (pk, custom1, custom2, custom3...custom50) Since the...
7
20916
by: David Bear | last post by:
I have a dictionary that contains a row of data intended for a data base. The dictionary keys are the field names. The values are the values to be inserted. I am looking for a good pythonic...
7
14784
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I...
1
1647
by: Michael Bray | last post by:
I have a table that stores data points for several different data sources. The general format is: DECLARE @Data TABLE ( DataID int, TimeCollected int, DataValue decimal(9,9) )
1
2965
by: Matik | last post by:
Hey, First, sorry if this post appear twice, because, I can not find my post recently send, trying to post it once again. I'm out of ideas, so, I thought, will search help here again :( I'm...
8
193939
MMcCarthy
by: MMcCarthy | last post by:
Type MemSize RetVal of VarType() Declaration Char Conversion Boolean 2b vbBoolean(11) CBool() Byte 1b vbByte(17) ...
6
2927
by: insirawali | last post by:
Hi all, I have this problem, i need to know is there a way i cn use the data adapter's update method in this scenario. i have 3 tables as below create table table1{ id1 int identity(1,1)...
0
7094
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6964
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7123
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7305
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5427
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4863
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4559
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3066
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.