All Questions
1,336 questions
1
vote
1
answer
78
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
103
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 ...
0
votes
0
answers
49
views
How to add substrings to an array?
I want to add to an array the substrings that this loop creates
foreach (char c in chars)
{
do
{
sb.Append(chars[i]);
choice = sb.ToString();
} while (c == chars[i]);
}...
1
vote
1
answer
135
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
67
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
67
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
118
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
69
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
119
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
88
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
1k
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 ...
-3
votes
1
answer
66
views
C# Split String Method separator.length > 1 explain code
I have data like this in a file:
AccountNumber#//#PinrCode#//#name#//#PhoneNumber#//#AccountBalance
I am using C# split separator that splits the string I get from the file and but the data in the ...
0
votes
1
answer
82
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
48
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 ...