How can read a file, split the strings in it, and write the output to a hashtable in C#? -
I have to read the file and the partition string in the hash table in C #.
For example;
1231231 Hi This is the first entry / Hello this is the second entry
Currently, I am reading lines in the file line using a StreamReader
According to the line, and then I divide each row into 3 separate stars, for example, "1231231" in a string, then sign the second string after "/" on the second string after the "/" sign.
1231231 The hash will be the key of the table, and the other hashes will be the table's value. I'm stuck on this part.
Assume that you have a fairly regular input, you may want to use it for it.
This pattern looks like you:
^ (\ d +) \ s + ([^ /] +) \ s + / \ s + (.
-
^
: Anchor to start the string < Code> (\ d +)
: One or more digits-
\ s +
: 1 or more white space characters -
([^ /] + / Code>: 1 or more characters that are not equal to '/'
\ s + / \ s +
: 1 or more white Place letters plus 1 slash and 1 or more white space characters(. +)
: 1 or more of any character-
$
: string Finally anchor
Comments
Post a Comment