[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3829: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3247)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3831: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3247)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3832: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3247)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3833: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3247)
Das Elektroniker-Forum • Thema anzeigen - In Bascom Variable Zerlegen??

In Bascom Variable Zerlegen??

Allgemeine Tipps und Kniffe für die Elektronik sind hier richtig

Moderator: dussel07

In Bascom Variable Zerlegen??

Beitragvon blueberlin » 09.10.2011, 10:10

Hallo,

ich habe Eine Variable:

dim Impuls as integer



so diese variable hat einen wert zwischen 0 und 9999

wie kann ich diese Zahl zerlegen?

ich möchte das die erste stelle in der Variable Stelle(1), die Zweite in die Variable Stelle(2) usw... zu finden ist, wie könnte ich das machen?

hier mal ein Beispiel:

Impuls hat den Wert 897

dann wäre Stelle(1)=0, Stelle(1)=8, Stelle(3)=9 und Stelle(4)=7

kann mir da jemand helfen?
habe schon gegoogelt aber nicht das richtige gefunden, alle themen die ich gesehen habe behandelten immer das thema wenn zwischen den zahlen ein symbol wie z.b : war :(
blueberlin
 
Beiträge: 236
Registriert: 23.09.2009, 19:23
Wohnort: Berlin

Re: In Bascom Variable Zerlegen??

Beitragvon Sebi » 09.10.2011, 10:26

Ich hoffe das hilft:
987 %10(Modolo, Rest beim Teilen)=7
987 - 7=980
980 / 10=98
98 % 10=8
98 - 8=90
90 / 10=9
(9 % 10=9)
Sebi
 
Beiträge: 842
Registriert: 10.08.2009, 17:57
Wohnort: Darmstadt

Re: In Bascom Variable Zerlegen??

Beitragvon blueberlin » 09.10.2011, 10:31

danke dir :)

ddas hat geholfen ;)
blueberlin
 
Beiträge: 236
Registriert: 23.09.2009, 19:23
Wohnort: Berlin

Re: In Bascom Variable Zerlegen??

Beitragvon Tim Sasdrich » 09.10.2011, 10:43

Ich glaube es gibt dafür einen Befehl, bin mir aber nicht Sicher.
Aber du könntest es auch mathematisch lösen.

0897/1000 = 0,897 => Nachkommastellen entfernen => 0
(0897-0*100)/100 = 8,97 => Nachkommastellen entfernen => 8
(0897-0*100-8*10)/10 = 9,7 => Nachkommastellen entfernen => 9
0897-0*100-8*10-9 = 7

Nachkommastellen entfernen geht mit dem Befehl INT. Bsp: INT (1234,56789) = 1234

Oder mit Modulo Division:
0897/10 = 89 Rest 7
89/10 = 8 Rest 9
8/10 = 0 Rest 8
0/10 = 0 Rest 0

Edit: Sebi war schneller
Tim Sasdrich
 
Beiträge: 2961
Registriert: 07.01.2009, 14:15
Wohnort: Villingen-Schwenningen


Zurück zu Tipps & Tricks

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 1 Gast

cron