Categories > Coding > C# >
[RELEASE] String to bool converter
Posted
hello got bored made this in a day have fun smh
using System.Text;
List<bool> StringToBool(string input)
{
var res = string.Empty;
foreach(var val in Encoding.UTF8.GetBytes(input))
{
var binary = Convert.ToString(val, 2);
while(binary.Length < 8)
{
binary = "0" + binary;
}
res += binary;
}
return res.Select(num => Convert.ToBoolean(char.GetNumericValue(num))).ToList();
}
string BoolToString(string input)
{
var res = string.Empty;
for (var i = 0; i < input.Split(' ').Length; i++)
{
res += input.Split(' ')[i] == "True" ? "1" : "0";
}
var list = new List<byte>();
for (var i = 0; i < res.Length; i += 8)
{
list.Add(Convert.ToByte(res.Substring(i, 8), 2));
}
return Encoding.UTF8.GetString(list.ToArray());
}
"Questionable intellegence, but I like the mystery" - CubeFaces
https://cdn.discordapp.com/attachments/1136067487847415848/1138948596679589898/sig.png
Replied
I don't know what do you want. Vouch
Cancel
Post
Join the Front-Page Club!
Replied
what is the point in that
Cancel
Post
Random quote here...
Replied
@VoidableMethod False True True False False False True False False True True False False False True True False False True False False False False False False True True False False True True False False True True True False True False True False True True False True True True False False True True False True True True False False True True True True False False True
Cancel
Post
"Questionable intellegence, but I like the mystery" - CubeFaces
https://cdn.discordapp.com/attachments/1136067487847415848/1138948596679589898/sig.png
Replied
godly code how to learn
Cancel
Post
Replied
Like i said you need to learn C# more LMFAO
bool.Parse(string);
//https://learn.microsoft.com/en-us/dotnet/api/system.convert.toboolean?view=net-6.0
Convert.ToBoolean(string);
//https://learn.microsoft.com/en-us/dotnet/api/system.boolean.parse?view=net-6.0
bool.TryParse(In, OUT) ; //like ur mom
//https://learn.microsoft.com/en-us/dotnet/api/system.boolean.tryparse?view=net-6.0
Cancel
Post
Discord Server: https://discord.gg/FPJyf3Cm
WeAreDevs is Filled With Skids nothing more
Replied
Are you stupid that won't work idiot
Cancel
Post
"Questionable intellegence, but I like the mystery" - CubeFaces
https://cdn.discordapp.com/attachments/1136067487847415848/1138948596679589898/sig.png
Discord Server: https://discord.gg/FPJyf3Cm
WeAreDevs is Filled With Skids nothing more
Replied
Cancel
Post
"Questionable intellegence, but I like the mystery" - CubeFaces
https://cdn.discordapp.com/attachments/1136067487847415848/1138948596679589898/sig.png
Replied
Cancel
Post
Discord Server: https://discord.gg/FPJyf3Cm
WeAreDevs is Filled With Skids nothing more
"Questionable intellegence, but I like the mystery" - CubeFaces
https://cdn.discordapp.com/attachments/1136067487847415848/1138948596679589898/sig.png
Replied
@SeizureSalad
pov yet again you dont know c#
LINQ with query syntax is also implemented using lambda expressions
Cancel
Post
Discord Server: https://discord.gg/FPJyf3Cm
WeAreDevs is Filled With Skids nothing more
"Questionable intellegence, but I like the mystery" - CubeFaces
https://cdn.discordapp.com/attachments/1136067487847415848/1138948596679589898/sig.png
Discord Server: https://discord.gg/FPJyf3Cm
WeAreDevs is Filled With Skids nothing more
Replied
@JoshuaTheFag with your numerous degrees and certifications don't you have something better to do
Cancel
Post
"Questionable intellegence, but I like the mystery" - CubeFaces
https://cdn.discordapp.com/attachments/1136067487847415848/1138948596679589898/sig.png
Users viewing this thread:
( Members: 0, Guests: 1, Total: 1 )
Cancel
Post