| View previous topic :: View next topic |
| Author |
Message |
dyl10s How do I cheat?
Reputation: 0
Joined: 21 Aug 2016 Posts: 5
|
Posted: Mon Aug 22, 2016 4:44 pm Post subject: Text to Float |
|
|
| I'm trying to pass text as a float(single) in VB.net. How does ce convert its text to a float value? |
|
| Back to top |
|
 |
hhhuut Grandmaster Cheater
Reputation: 6
Joined: 08 Feb 2015 Posts: 607
|
Posted: Mon Aug 22, 2016 4:47 pm Post subject: |
|
|
There's a function called StrToFloat and anotherone called Val.
But I don't know if you can make use of that in VB too ... |
|
| Back to top |
|
 |
dyl10s How do I cheat?
Reputation: 0
Joined: 21 Aug 2016 Posts: 5
|
Posted: Mon Aug 22, 2016 4:48 pm Post subject: |
|
|
| hhhuut wrote: | There's a function called
But I don't know if you can make use of that in VB too ... |
This wont help me much but thanks for the attempt. |
|
| Back to top |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Mon Aug 22, 2016 5:58 pm Post subject: |
|
|
CE's Lua
| Code: | local text = "3.5"
local value = tonumber(text)
print(value) |
VB.NET
| Code: | string text = "3.5";
float value = float.Parse(text);
Console.WriteLine("{0}", value); |
Or was that C#... maybe
| Code: | Dim text As String = "3.5"
Dim value As Single = Convert.ToSingle(text)
Console.WriteLine("{0}", value) |
|
|
| Back to top |
|
 |
dyl10s How do I cheat?
Reputation: 0
Joined: 21 Aug 2016 Posts: 5
|
Posted: Tue Aug 23, 2016 8:43 am Post subject: |
|
|
| I actually need to convert a string that is an actual word like "Score" |
|
| Back to top |
|
 |
unknown_k Expert Cheater
Reputation: 5
Joined: 24 May 2011 Posts: 211
|
Posted: Tue Aug 23, 2016 8:47 am Post subject: |
|
|
| dyl10s wrote: | | I actually need to convert a string that is an actual word like "Score" |
Are you kidding?  |
|
| Back to top |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Tue Aug 23, 2016 6:09 pm Post subject: |
|
|
| Everyone knows "Score" translates to the float value 4.741567549E30. |
|
| Back to top |
|
 |
hhhuut Grandmaster Cheater
Reputation: 6
Joined: 08 Feb 2015 Posts: 607
|
Posted: Wed Aug 24, 2016 2:10 am Post subject: |
|
|
| But since "Score" has five characters and therefore is five bytes long, while a float only has four bytes, you're still missing one byte of information ... |
|
| Back to top |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Wed Aug 24, 2016 4:45 pm Post subject: |
|
|
| It's called truncation. Get with the times! |
|
| Back to top |
|
 |
|