Tagged Questions
5
votes
3answers
105 views
Getting middle three characters of an odd length string
I want to retrieve the middle three characters of a given odd length string.
Eg. if
string original = "India" // expected output - "ndi"
string original = "America" // expected output - "eri"
I ...
3
votes
7answers
82 views
Remove words in string from words in array with c#
I need to remove words from a string based on a set of words:
Words I want to remove:
DE DA DAS DO DOS AN NAS NO NOS EM E A AS O OS AO AOS P LDA AND
If I receive a string like:
EDIT: This string ...
1
vote
4answers
47 views
Using LSET or RSET in a c#-aspx application
I'm probably missing something obvious, but I can't seem to be able to use LSET and RSET string functions in a c# Code-Behind page.
My code is as follows :
string ts = LSet(someString, 16);
...
1
vote
4answers
65 views
LINQ approach to parse lines with keys/values
I have the following string
MyKey1=MyVal1
MyKey2=MyVal2
MyKey3=MyVal3
MyKey3=MyVal3
So first, in need to split into lines, then I need to split each line by '=' char to get key and value from ...
0
votes
1answer
30 views
C# extract escape character from string
I'm reading an encoded string into memory and decode it.
The string is something like "test\file1.txt".
Normally, C# would see this as string literal "test \\ file1.txt", correctly assigning an ...
0
votes
3answers
48 views
Constants vs enum regarding to parsing
I'm currently writing a simple parser for streaming information delivered using the Session Description Protocol (SDP; see: https://tools.ietf.org/html/rfc4566).
For various fields, such as ...
0
votes
3answers
49 views
Removing matching characters between two strings
I want to remove the characters which are matching between the two given strings. Eg.
string str1 = "Abbbccd";
string str2 = "Ebbd";
From these two strings I want the output as:
"Abcc", only those ...
0
votes
3answers
58 views
How do I know which delimiter was used when delimiting a string on multiple delimiters? (C#)
I read strings from a file and they come in various styles:
item0 item1 item2
item0,item1,item2
item0_item1_item2
I split them like this:
string[] split_line = line[i].split(new char[] {' ...
3
votes
3answers
66 views
check if there is any of the chars inside the textbox
I have a chararray on global, button and textbox, how do I check if the word in textBox1.Text contains the letters in the chararray?
char[] letters = { 'a', 'e' };
private void button1_Click(object ...
0
votes
1answer
52 views
“The call is ambiguous” (Calling a method with the same data structure)
I'm trying to call a method (EmptyFolderContents) with the (recent) system variable, but I get this message:
The call is ambiguous between the following methods or properties
So how do I ...
2
votes
4answers
102 views
How to separate 1 string into multiple strings [duplicate]
How do I convert "ThisIsMyTestString" into "This Is My Test String" using C#?
Is there a fast way to do it?
I've been thinking of a pseudo code but it's complicated and ugly:
String s = ...
2
votes
3answers
137 views
How slow is passing large strings as return values in C#?
I want to know how return values for strings works for strings in C#. In one of my functions, I generate html code and the string is really huge, I then return it from the function, and then insert it ...
1
vote
3answers
56 views
Parsing group of rows from many rows
I am trying to parse a group of lines in a string[] that looks like the following:
junk ....
Title Mr ..... <-- begin relevant data
alias johnsmith...
alias john.smith...
Salutation ... <-- ...
0
votes
1answer
26 views
Serialize object into string
I am trying to serialize a class to be sent to a server where the server will use that object. I am using Microsoft's example of an asynchronous client/server setup for this: ...
-2
votes
2answers
38 views
How do I split a path at specific directory? [on hold]
I have the following path...
'X:\Projects\4604-Renovation\Unity\4604_02\Assets\Models\FullBuilding\Materials\'
I want to split it at the directory 'Assets' and end up with...
...