473,324 Members | 2,179 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

string[] strVarArr = strVar.Split('x'); - Empty character literal error

When on my development machine, I can execute the code in the subject
(string[] strVarArr = strVar.Split('x');) without any problems. When I
try to move the code to my server, I get "CS1011: Empty character
literal."

I thought perhaps it was a font issue, but I verified that the font is
available on the server, that the character codes are the same, and
that the sql character set is the same in both places.

I'm sure this is covered somewhere, but I've been unable to form a
proper query in google to come up with an answer.

I'm using ASP.NET C# 2.0x, running on IIS 6

Any help is greatly appreciated.

thanks,

g

Feb 16 '07 #1
9 5704
<gv*******@gmail.comwrote:
When on my development machine, I can execute the code in the subject
(string[] strVarArr = strVar.Split('x');) without any problems. When I
try to move the code to my server, I get "CS1011: Empty character
literal."

I thought perhaps it was a font issue, but I verified that the font is
available on the server, that the character codes are the same, and
that the sql character set is the same in both places.

I'm sure this is covered somewhere, but I've been unable to form a
proper query in google to come up with an answer.

I'm using ASP.NET C# 2.0x, running on IIS 6
I can't see how fonts could have anything to do with it. My guess is
that in moving the code over you've changed it to:

string[] strVarArr = strVar.Split('');

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Feb 16 '07 #2
On 16 Feb, 04:45, gvanos...@gmail.com wrote:
When on my development machine, I can execute the code in the subject
(string[] strVarArr = strVar.Split('x');) without any problems. When I
try to move the code to my server, I get "CS1011: Empty character
literal."
Is this the actual code you're using or demo code?

i.e. Is the code on your server really using 'x' as the parameter or
is it obtaining it from somewhere else?

Feb 16 '07 #3
On Feb 16, 6:15 am, "Bobbo" <robin.willi...@choicequote.co.ukwrote:
On 16 Feb, 04:45, gvanos...@gmail.com wrote:
When on my development machine, I can execute the code in the subject
(string[] strVarArr = strVar.Split('x');) without any problems. When I
try to move the code to my server, I get "CS1011: Empty character
literal."

Is this the actual code you're using or demo code?

i.e. Is the code on your server really using 'x' as the parameter or
is it obtaining it from somewhere else?
It is a literal character in the split statement (using single
quotation marks). The actual character is "¶". (U+00B6 or "pilcrow
sign" in window's character map).

Feb 16 '07 #4
<gv*******@gmail.comwrote:
i.e. Is the code on your server really using 'x' as the parameter or
is it obtaining it from somewhere else?
It is a literal character in the split statement (using single
quotation marks). The actual character is "¶". (U+00B6 or "pilcrow
sign" in window's character map).
How are you representing that in the code?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Feb 16 '07 #5
On Feb 16, 4:40 pm, Jon Skeet [C# MVP] <s...@pobox.comwrote:
<gvanos...@gmail.comwrote:
i.e. Is the code on your server really using 'x' as the parameter or
is it obtaining it from somewhere else?
It is a literal character in the split statement (using single
quotation marks). The actual character is "¶". (U+00B6 or "pilcrow
sign" in window's character map).

How are you representing that in the code?

--
Jon Skeet - <s...@pobox.com>http://www.pobox.com/~skeet Blog:http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
like this...

string[] strVarArr = strVar.Split('¶');

in your original reply, you mentioned that maybe the character wasn't
there on the server, but the error message actually displays the
character when it's telling me that there's no character.

thanks.

g

Feb 16 '07 #6
<gv*******@gmail.comwrote:
How are you representing that in the code?
like this...

string[] strVarArr = strVar.Split('¶');

in your original reply, you mentioned that maybe the character wasn't
there on the server, but the error message actually displays the
character when it's telling me that there's no character.
It could well be an encoding issue. I suggest you use:
string[] strVarArr = strVar.Split('\u00b6');

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Feb 16 '07 #7
On Feb 16, 4:59 pm, Jon Skeet [C# MVP] <s...@pobox.comwrote:
<gvanos...@gmail.comwrote:
How are you representing that in the code?
like this...
string[] strVarArr = strVar.Split('¶');
in your original reply, you mentioned that maybe the character wasn't
there on the server, but the error message actually displays the
character when it's telling me that there's no character.

It could well be an encoding issue. I suggest you use:
string[] strVarArr = strVar.Split('\u00b6');

--
Jon Skeet - <s...@pobox.com>http://www.pobox.com/~skeet Blog:http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
I'll try that. I thought about it, but didn't know the syntax. I'll
reply after I give it a shot.

txs.

Feb 16 '07 #8
On Feb 16, 5:25 pm, gvanos...@gmail.com wrote:
On Feb 16, 4:59 pm, Jon Skeet [C# MVP] <s...@pobox.comwrote:
<gvanos...@gmail.comwrote:
How are you representing that in the code?
like this...
string[] strVarArr = strVar.Split('¶');
in your original reply, you mentioned that maybe the character wasn't
there on the server, but the error message actually displays the
character when it's telling me that there's no character.
It could well be an encoding issue. I suggest you use:
string[] strVarArr = strVar.Split('\u00b6');
--
Jon Skeet - <s...@pobox.com>http://www.pobox.com/~skeet Blog:http://www..msmvps.com/jon.skeet
If replying to the group, please do not mail me too

I'll try that. I thought about it, but didn't know the syntax. I'll
reply after I give it a shot.

txs.
thanks much. it worked. not that it matters at this point, but why do
you suppose that would happen even though it had the same character
code on both machines?

Feb 16 '07 #9
<gv*******@gmail.comwrote:
thanks much. it worked. not that it matters at this point, but why do
you suppose that would happen even though it had the same character
code on both machines?
Different machines may have different default encodings. In general,
embedding non-ascii characters directly in source code is a problem
waiting to happen.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Feb 17 '07 #10

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

Similar topics

14
by: Christopher Benson-Manica | last post by:
I'm trying to check whether a string is all digits. This part is easy: function allDigits( str ) { var foo=str.split( '' ); // better than charAt()? for( var idx=0; idx < foo.length; idx++ ) {...
12
by: Vicky | last post by:
What is the better way of checking blank string is it strvar.lenght > 0 or strvar == "" or something else Thnaks
19
by: David Logan | last post by:
We need an additional function in the String class. We need the ability to suppress empty fields, so that we can more effectively parse. Right now, multiple whitespace characters create multiple...
20
by: Guadala Harry | last post by:
In an ASCX, I have a Literal control into which I inject a at runtime. litInjectedContent.Text = dataClass.GetHTMLSnippetFromDB(someID); This works great as long as the contains just...
4
by: Crirus | last post by:
There is a function somewhere to split a string with multiple tokens at a time? Say I have this: aaaa#bbbbb*ccccc$dddd I whould like to split it so the result whould be aaaa bbb
5
by: kurt sune | last post by:
The code: Dim aLine As String = "cat" & vbNewLine & "dog" & vbNewLine & "fox" & vbNewLine Dim csvColumns1 As String() = aLine.Split(vbNewLine, vbCr, vbLf) Dim csvColumns2 As String() =...
7
by: Sling | last post by:
I code in Rexx on the mainframe which has 2 built-in functions: word(s,i) & words(s). word(s,i) returns the ith word in the s(tring), and words(s) returns the number of words within the s(tring)....
18
by: Kyro | last post by:
New to C# (migrating from Delphi) and I'm not sure how to get a delimited string into an array of string. input: string looks like - 01-85-78-15-Q11 output: an array with elements - ...
24
by: garyusenet | last post by:
I'm working on a data file and can't find any common delimmiters in the file to indicate the end of one row of data and the start of the next. Rows are not on individual lines but run accross...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.