Home > Net >  On the c # String. The split (params char [] the separator)
On the c # String. The split (params char [] the separator)

Time:10-10

On the issue of the character segmentation function, has compiled executable problem, I in win 7. The.net runtime 4.6 environment can be normal use, but in the win 10. NET 4.7.2, has been submitted to this function has a problem, don't know what the reason, check on the Microsoft website, above can be normal use, but it is an error, the following is an error code, is there any great god know, inform, thank you.
The code is as follows:

 string [] STR=DataInput_KeyBoardLocation. Text. The Split (', '); The Regex. 
List. DataInputInformation. KeyShowPosition_X=the Convert. ToUInt16 (STR [0]).



The DataInput_KeyBoardLocation. The Text is such as "0245078" string

Report error is as follows:
Detailed information about how to call, please refer to this message at the end of the
Real-time debugging (JIT) instead of the dialog box,

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
System,
FormatException: the format of the input string is not correct,
 em System. Number. StringToNumber (String STR, NumberStyles options, NumberBuffer& The number of NumberFormatInfo info, Boolean parseDecimal) 
Em System. Number. ParseUInt32 (String value, NumberStyles options, NumberFormatInfo numfmt)
Em System. UInt16. Parse (String s, NumberStyles style, NumberFormatInfo info)
Em System. The Convert. ToUInt16 (String value)
Em TGUS. Touch. DataInput_KeyBoardSet_Click (Object sender, EventArgs e) na e: \ Touch cs: linha 4808
[code=csharp]

[/code]
Above suggests that string format is wrong, but in win 7 above can run normally, no errors, change the win 10 computer wouldn't work, and not every win 10 computers is so, some can, some not.

CodePudding user response:

Have a great god know? Very urgent, for several days, have not been solved

CodePudding user response:

I doubt you input the Chinese comma (or Chinese characters) and win10 has nothing to do.

CodePudding user response:

You are not the correct split,
Is the Convert. ToUInt16 (STR [0]) error

CodePudding user response:

Debugging see STR [0] value is how much you know

CodePudding user response:

refer to the second floor hanghangz response:
I doubt you input the Chinese comma (or Chinese characters). Have nothing to do with win10.

Sorry not see BBS recently, just saw, I checked several times, no input errors, the comma is English.

CodePudding user response:

refer to the third floor is nu month god reply:
you are not the correct split,
Is the Convert. ToUInt16 (STR [0]) error:

I also suspect that the at first, but I revised or error, only to find that is split an error, a great god is there any other solution, I have put this on hold, blare...

CodePudding user response:

Try catch
Then the output your Str [0]
This kind of problem, only need to see a slice of string, and what is the original string, can judge the bug,

CodePudding user response:

refer to 6th floor RadishV response:
Quote: refer to the third floor is nu month god reply:

You are not the correct split,
Is the Convert. ToUInt16 (STR [0]) error:

I also suspect that the at first, but I revised or error, only to find that is split an error, a great god is there any other solution, I have put this on hold, blare...

When you are debugging, if the input is 0245078
Then, an error of line, is in
This line of string [] STR=DataInput_K,,,,,,,,,,,
Is this line list. DataInputInformation. K,,,,,,,,,,,,,,

CodePudding user response:

 
//simulation dataThe dynamic DataInput_KeyBoardLocation=new {Text="0245078"};

String [] STR=DataInput_KeyBoardLocation. Text. The Split (', ');

//the above code no problem

//this code the building Lord you're wrong,
System. Text. RegularExpressions. Regex. List. DataInputInformation. KeyShowPosition_X=the Convert. ToUInt16 (STR [0]).

CodePudding user response:

refer to the eighth floor is nu month god reply:
Quote: refer to the sixth floor RadishV response:

Quote: refer to the third floor is nu month god reply:

You are not the correct split,
Is the Convert. ToUInt16 (STR [0]) error:

I also suspect that the at first, but I revised or error, only to find that is split an error, a great god is there any other solution, I have put this on hold, blare...

When you are debugging, if the input is 0245078
Then, an error of line, is in
This line of string [] STR=DataInput_K,,,,,,,,,,,
Is this line list. DataInputInformation. K,,,,,,,,,,,,,,

In the split
  •  Tags:  
  • C #
  • Related