Latest Uploads
PixeLink P ... zle Editor

rockford

PixeLink

rockford

image-21-0 ... -21-29.jpg

Jayenkai

image-15-0 ... -19-40.jpg

Jayenkai

image-15-0 ... -20-07.jpg

Jayenkai

Bumble Bee

dna

Forum Home

array Problem

UserMessage
Posted : Saturday, 07 January 2012, 19:06 | Permalink
dna



Hey.

I'm trying to pass an array into a function and change certain characters within the string.

This code is giving me an error. Is it the square bracket?

-->

-----
DNA
Posted : Sunday, 08 January 2012, 12:00 | Permalink | Mark Here
bram32


WW Entries : 1
Hey dna,
I think it is the assignment to Mid$ that doesn't work:

Mid$(E$[J],S,1)="/"

Should be something like:
E$[J] = Left$(E$[j],S-1) + "/" + Mid$(E$[j],S+1)
Homepage : http://members.home.nl/bramdenhond/haxic
Posted : Sunday, 08 January 2012, 20:54 | Permalink | Mark Here
dna


A type mismatch now

-->

The dim does not work.

Does Blitz pass string arrays?


-----
DNA
Posted : Monday, 09 January 2012, 16:04 | Permalink | Mark Here
Evil Roy Ferguson


WW Entries : 3
Blitz's array support is anemic. You can pass string arrays to methods, but the so called "blitzarrays" break if you specify the type anywhere but declaration. That is to say, the following will work:

-->

No idea what you're doing, though...
Posted : Monday, 09 January 2012, 19:15 | Permalink | Mark Here
dna


Thanks Evil One

Still, It compiles but does not pass the array.

Must be some funny syntax.

the program will replace any occurrence of Upper or Lower case B with a "/".

From there it will do something else.

I might be able to get the result using integers instead of passing the string to the function. Just compare the integer to the "/" equivalent.

-----
DNA
Posted : Monday, 09 January 2012, 22:13 | Permalink | Mark Here
Retro


I'm no Blitz expert, so apologies if this is utter crap.

It seems to me you could wrap the string array in a custom type.
This would be passed by reference, e.g.

-->
Posted : Tuesday, 10 January 2012, 19:27 | Permalink | Mark Here
dna


That probably is the best method (no pun) for doing what I'm attempting.

I did want to know the square bracket string array syntax though.

-----
DNA
Posted : Tuesday, 10 January 2012, 20:05 | Permalink | Mark Here
Retro


I guess if you use that method, you may as well not use an array at all.
i.e. just use the built-in type iterators. They're stored in a linked-list, so effectively you'd have a dynamic array.
Posted : Tuesday, 10 January 2012, 20:53 | Permalink | Mark Here
dna


You are right again but the algorithm was created to test the use of passing those square bracket arrays.

It's undocumented in some versions of BB

I'll learn types then.

-----
DNA
Posted : Tuesday, 10 January 2012, 21:05 | Permalink | Mark Here
Evil Roy Ferguson


WW Entries : 3
Passing in the array works; the line doing it was just commented out in your example above and I did not change it back.
Posted : Tuesday, 10 January 2012, 21:31 | Permalink | Mark Here
dna


I removed the comment and the string array did not pass. I got a Variable type mismatch error.

-----
DNA
Posted : Tuesday, 10 January 2012, 22:42 | Permalink | Mark Here
Evil Roy Ferguson


WW Entries : 3
That's because you're passing in a single element of the array with INS(R[0]) instead of the array, when what you need is just INS®. You also can't print the result of that, since it doesn't return anything.
Posted : Wednesday, 11 January 2012, 21:52 | Permalink | Mark Here
dna



Found my syntax error
-->

This is right.

-----
DNA
Posted : Thursday, 12 January 2012, 02:36 | Permalink | Mark Here
Retro


Can't you just use the Replace$ function?

-->
Posted : Thursday, 12 January 2012, 11:54 | Permalink | Mark Here
dna


Yes I could have.
I never knew the command existed before. That looks easier than using the mid$ function.
What I wrote is probably the same somewhere inside the REPLACE function.



-----
DNA
Posted : Thursday, 12 January 2012, 17:13 | Permalink | Mark Here
Retro


Unlikely. The library functions would be C/C++ not BlitzBasic.
Posted : Thursday, 12 January 2012, 19:02 | Permalink | Mark Here
dna


You're right again but I meant the logistics of how it works.
thanks for pointing that out to me.
I have never really read the B3D manual.



-----
DNA
Latest Posts
Zero Hour Jam
Jayenkai Sat 06:55
Sweets
steve_ancell Sat 06:09
Merchandising : Window Shopping
Kuron Sat 04:58
New Mac woes
Kuron Fri 16:12
Corner Gas : The Movie
Jayenkai Fri 16:00
RIP : Jay's Nan
blanko1324 Fri 15:35
HoverBoards FTW!
steve_ancell Fri 15:04
Facebook Rooms
Jayenkai Fri 10:37
Grrrrr Nintendo!....
rockford Fri 09:17
Willpower
rychan Fri 06:53
More

Latest Items
Woot : Update on hand issues
Kuron Fri 10:34
News : Newsletter #240
steve_ancell Fri 05:29
Techy : My Newest Toys
Jayenkai Sun 04:16
News : Newsletter #239
Jayenkai Sat 05:34
Showcase : Preppie!
Jayenkai Fri 13:00
Rant : I Stubbed My Toe...
steve_ancell Tue 09:47
Blog : Bedroom 2.0
Kuron Mon 18:59
Link : Message(s) from the grave
Jayenkai Tue 09:27
Blog : 20 Years Ago....
steve_ancell Mon 15:28
Life : Back Online
Kuron Tue 11:48
Showcase : Munky Blocks DX
Jayenkai Mon 07:06
Showcase : Little Nemo's Nightmare
Jayenkai Sat 04:14
News : Newsletter #234
rychan Fri 08:02
Showcase : Space Rocket Adventurers
HoboBen Thu 16:56
Blog : Health Update : August 2014
Jayenkai Sat 11:31
More

Who's Online
Jayenkai
Sat, at 07:59
rychan
Sat, at 07:45
blanko1324
Sat, at 07:36
rockford
Sat, at 07:20
steve_ancell
Sat, at 06:45
Kuron
Sat, at 06:35
Krakatomato
Sat, at 04:34
spinal
Sat, at 00:17
shroom_monk
Fri, at 15:38
dna
Fri, at 12:53
Link to this page
Site : Jayenkai 2006-Infinity | MudChat's origins, BBCode's former life, Image Scaler.