All Questions
1,335 questions
-10
votes
2
answers
139
views
Custom method to split a string into a string array not appending the last string to the array in C# [closed]
Decided to develop my own method that splits a string in C# into an array of strings using the StringBuilder class. The code is adding all the words to the array except the last word. An example would ...
0
votes
0
answers
42
views
Can I use the String.Split() method overloads while splitting at white-space characters without having to specify the white-space characters? [duplicate]
I'm trying to split a string into an array of strings. I want to split at every at white-space character and also use StringSplitOptions to remove and trim the empty entries.
Is it somehow possible to ...
1
vote
1
answer
81
views
Function is not working, but gives no error
I'm new to C#. I'm trying to make game in Unity. These functions are necessary for changing in-game tabs with help of a button.
public string check;
public CanvasGroup hydrogenScreen;
public ...
0
votes
4
answers
120
views
How to concat various chunks of string array based on a condition
Lets say i have a string array like this,
string[] array1 = {
"<p>here is a big sentence</p>",
"file1",
"file2",
"<p>this is a big ...
1
vote
1
answer
148
views
Find errors: Array - wrong output
I'm writing string[] to show multiple rows in the output. A stupid question, why the output is not 5 x 5?(I used i and j both from 0-4, then the ouput should be an array 5 x 5), can anyone help?
<...
0
votes
0
answers
80
views
C# array of string not nullable but init with null string[] arrayOfString = new string[2];
Working with VS2022 and .NET 8 with <Nullable>Enabled</Nullable> for my project.
I encounter null pointer exception at run time with the following code:
string[] arrayOfString = new string[...
-1
votes
1
answer
72
views
Check if any value from Array1 Contains any value from Array2
How can I check if a value from an Array Contains any value from an other Array ?
For example:
string[] array1 = {"1726KB12","271","MB192"}
string[] array2 = {"KB&...
-3
votes
1
answer
68
views
An unhandled exception of type 'System.IndexOutOfRangeException' occurred in c# from a string array [closed]
string[] user = { "a" } , pass ={ "a" };
string check1, check2;
string TBTOS;
bool correct = false;
int howmanyusers = 0;
howmanyusers++;
...
0
votes
1
answer
133
views
How to find the index of words in array with specific letter?
I have a string list where i add my Tags.
A Tag cotains a Line, Source and Target.
Tag example: L02_FTxx10_STxx5
L02 -> Line
FTxx10 -> Source
STxx5 -> Target
I split every tag into an array ...
-3
votes
1
answer
70
views
problems with null and empty string array
class ToDoList {
public static void toDO() {
List<string[]> addEntry = [];
bool toDoLoop = true;
while (toDoLoop) {
Clear();
WriteLine(&...
-1
votes
3
answers
125
views
C# Lambda Convert Comma Seperated Upper case string with spaces to Titlecase with Trim
I have a Comma separated Upper case string with spaces that needs to be converted into a comma separated string in Title Case and trim the end spaces only.
Sample String:
"BAHAMAS, BAHRAIN, BANGLADESH,...
-1
votes
2
answers
91
views
Separating text and then put them back in a reverse order
I'm trying to break down a sentence into its words and then output them back in the wrong order.
I can't get to my current error, because the program stops working halfway through the sentence and ...
3
votes
3
answers
2k
views
How to create a new string array out of the elements of given string array?
I am given a string array and I have to create a new string array out of it with strings that are, say, less than 3 characters long. The problem is that I am not allowed to use lists, so everything ...
0
votes
1
answer
99
views
Source String: linq find any (array) and replace
I did review the following, it did help in some aspects, but not to find a final solution:
C# replace strings in array with LINQ
Replacing characters in a string array with linq
Linq to SQL replace ....
0
votes
0
answers
50
views
How to get a string[] as value from a Dictionary<int, string[]> regroup all value
I have a Dictionary<int, string[]>.
And I want to know, if with the functions of Enumerable/Collection it's possible to get in one line "approximatly", to regroup all string[] value in ...