Categories > Coding > C# >

[RELEASE] String to bool converter

SeizureSalad

i love femboys

Posts: 1159

Threads: 79

Joined: Mar, 2021

Reputation: 40

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());
}

  • 0

"Questionable intellegence, but I like the mystery" - CubeFaces

https://cdn.discordapp.com/attachments/1136067487847415848/1138948596679589898/sig.png

Cuby

Student loans

vip

Posts: 207

Threads: 5

Joined: Mar, 2019

Reputation: 62

Replied

I don't know what do you want. Vouch

  • 0

Join the Front-Page Club!

Posts: 2014

Threads: 198

Joined: Apr, 2021

Reputation: 16

Replied

what is the point in that

  • 0

Random quote here...

SeizureSalad

i love femboys

Posts: 1159

Threads: 79

Joined: Mar, 2021

Reputation: 40

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

  • 0

"Questionable intellegence, but I like the mystery" - CubeFaces

https://cdn.discordapp.com/attachments/1136067487847415848/1138948596679589898/sig.png

Posts: 3

Threads: 0

Joined: Sep, 2022

Reputation: -2

Replied

godly code how to learn

  • 0

Posts: 31

Threads: 3

Joined: Sep, 2022

Reputation: -34

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
  • 0

Discord Server: https://discord.gg/FPJyf3Cm

WeAreDevs is Filled With Skids nothing more

SeizureSalad

i love femboys

Posts: 1159

Threads: 79

Joined: Mar, 2021

Reputation: 40

Replied

Are you stupid that won't work idiot

  • 0

"Questionable intellegence, but I like the mystery" - CubeFaces

https://cdn.discordapp.com/attachments/1136067487847415848/1138948596679589898/sig.png

Posts: 31

Threads: 3

Joined: Sep, 2022

Reputation: -34

Replied

@SeizureSalad

Bark for me HAHAHAHA you clealy cant code

  • 0

Discord Server: https://discord.gg/FPJyf3Cm

WeAreDevs is Filled With Skids nothing more

SeizureSalad

i love femboys

Posts: 1159

Threads: 79

Joined: Mar, 2021

Reputation: 40

Replied

@JoshuaTheFag you can't either smh

 

also if i can't code then tf is this release then

  • 0

"Questionable intellegence, but I like the mystery" - CubeFaces

https://cdn.discordapp.com/attachments/1136067487847415848/1138948596679589898/sig.png

Posts: 31

Threads: 3

Joined: Sep, 2022

Reputation: -34

Replied

@SeizureSalad

lambda expression LMFAO

POINTLESS EXAMPLE OF DOING MORE WORK THEN NEEDED!

  • 0

Discord Server: https://discord.gg/FPJyf3Cm

WeAreDevs is Filled With Skids nothing more

SeizureSalad

i love femboys

Posts: 1159

Threads: 79

Joined: Mar, 2021

Reputation: 40

Replied

@JoshuaTheFag pov you don't know what linq is

  • 0

"Questionable intellegence, but I like the mystery" - CubeFaces

https://cdn.discordapp.com/attachments/1136067487847415848/1138948596679589898/sig.png

Posts: 31

Threads: 3

Joined: Sep, 2022

Reputation: -34

Replied

@SeizureSalad
 pov yet again you dont know c#

LINQ with query syntax is also implemented using lambda expressions

  • 0

Discord Server: https://discord.gg/FPJyf3Cm

WeAreDevs is Filled With Skids nothing more

SeizureSalad

i love femboys

Posts: 1159

Threads: 79

Joined: Mar, 2021

Reputation: 40

Replied

@JoshuaTheFag 6dyftyftrvujyftvrjhyjfjtyfgvyhkjg tyi i76trf 6j joijjh giu

  • 0

"Questionable intellegence, but I like the mystery" - CubeFaces

https://cdn.discordapp.com/attachments/1136067487847415848/1138948596679589898/sig.png

Posts: 31

Threads: 3

Joined: Sep, 2022

Reputation: -34

Replied

  • 0

Discord Server: https://discord.gg/FPJyf3Cm

WeAreDevs is Filled With Skids nothing more

SeizureSalad

i love femboys

Posts: 1159

Threads: 79

Joined: Mar, 2021

Reputation: 40

Replied

@JoshuaTheFag with your numerous degrees and certifications don't you have something better to do 

  • 0

"Questionable intellegence, but I like the mystery" - CubeFaces

https://cdn.discordapp.com/attachments/1136067487847415848/1138948596679589898/sig.png

Next >>>

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )