Latest Uploads
Duck Invaders

zzoom

Smaller Scar?

zzoom

Big Scar

Jayenkai

Swirly Thing

Jayenkai

Best Title

rychan

Spaceplosi ... nator 2086

rychan

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
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
dna


A type mismatch now

-->

The dim does not work.

Does Blitz pass string arrays?


-----
DNA
Posted : Monday, 09 January 2012, 16:04 | Permalink
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
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
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
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
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
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
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
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
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
dna



Found my syntax error
-->

This is right.

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


Can't you just use the Replace$ function?

-->
Posted : Thursday, 12 January 2012, 11:54 | Permalink
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
Retro


Unlikely. The library functions would be C/C++ not BlitzBasic.
Posted : Thursday, 12 January 2012, 19:02 | Permalink
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
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 723|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Latest Posts
Feedback is King
Jayenkai Fri 02:54
What Have You Done - Sept 2016
Jayenkai Fri 01:41
No Power!!
rockford Thu 23:30
GoPro Hero 4 Silver vs Nikon KeyMission 170
otakupunk Thu 18:28
Crystal Maze Returns
Jayenkai Thu 11:37
Jay Gets XBoned...
rockford Thu 11:30
WW - #248 - The Duck Challenge
zzoom Thu 09:58
Kuron vs His Parents?
Kuron Thu 02:44
WW - #249 - The Symmetrical Challenge
rychan Thu 00:39
The New Fiver
Jayenkai Wed 15:02
More

Latest Items
Dev-Diary : 1st Ever Wed Workshop Progress
Jayenkai Thu 10:13
Dev-Diary : Intellivision Controller Adapter
spinal Sun 11:33
Snippet : Contour Map from Data
HoboBen Fri 18:14
Snippet : FPS Control (WASD+Mouse)
Pakz Wed 22:30
Article : Concurrency in C#
Afr0 Sun 12:28
Snippet : Mandelbrot in BMax
Jayenkai Sun 03:37
News : Newsletter #281
HoboBen Fri 04:18
News : Newsletter #280
Jayenkai Sat 05:10
Blog : Monkey-X Box2D: Learning from my perspective... Hopefully!
steve_ancell Sun 14:49
Snippet : JNKrunch v1.0
spinal Sun 12:02
Snippet : Dungeon/Cave Generator - Simple
Pakz Wed 15:05
Snippet : Platform Sprite Generator
Jayenkai Tue 15:22
Snippet : Code Creates Crates
HoboBen Tue 07:02
Snippet : Texture - Leafy camouflage
HoboBen Tue 07:00
Snippet : Texture - Stone 3
Pakz Mon 09:55
More

Who's Online
Jayenkai
Fri, at 03:18
spinal
Fri, at 03:06
Kuron
Fri, at 02:29
Pakz
Fri, at 02:20
shroom_monk
Fri, at 01:30
waroffice
Fri, at 01:20
Cower
Fri, at 00:59
rockford
Fri, at 00:28
GfK
Fri, at 00:18
steve_ancell
Thu, at 21:56
Link to this page
Site : Jayenkai 2006-Infinity | MudChat's origins, BBCode's former life, Image Scaler.