StringField Bugs PB573

Just starting out? Need help? Post your questions and find answers here.
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

StringField Bugs PB573

Post by Saki »

StringField Bugs PB573

; Empty result

Code: Select all

string$="*aaaaaaaaaa*Hello*I*am*a*splitted*"
Debug StringField(string$, 1 , "*")
; 6 Fields - Start Index=1 - End Index=6 - With 7 it work

Code: Select all

For index = 1 To 6
 Debug StringField("*Hello*I*am*a*splitted*string*", index , "*")
 Next
 
; Index should no longer be separated as a field here - Also the parameter 7 does not fit

Code: Select all

For index = 1 To 7
 Debug StringField("*Hello*I*am*a*splitted*string", index , "*")
 Next
 
// Edit: Moved from "Bugs" to "Coding Questions" (Kiffi)
Last edited by Saki on Mon May 03, 2021 1:10 pm, edited 1 time in total.
地球上の平和
#NULL
Addict
Addict
Posts: 1440
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

Re: StringField Bugs PB573

Post by #NULL »

no bug.

one field: "a"
two fields: "a*a"
one empty field: ""
two empty fields: "*"
; Empty result
the first field spans from the beginning of the string to the first *
; 6 Fields - Start Index=1 - End Index=6 - With 7 it work
because it has 7 fields. the first field is before the first *

and why a second topic?
BarryG
Addict
Addict
Posts: 3324
Joined: Thu Apr 18, 2019 8:17 am

Re: StringField Bugs PB573

Post by BarryG »

Not a bug. Here's a count of all the stringfields in your string:

Code: Select all

 *aaaaaaaaaa*Hello*I*am*a*splitted*
1 2          3     4 5  6 7        8
So, the first stringfield is to the left of the first asterisk, thus = nothing. Same for the last stringfield.

Here's an alternative way to do what you want, by stripping the first and last asterisks:

Code: Select all

string$="*aaaaaaaaaa*Hello*I*am*a*splitted*"
Debug StringField(Trim(string$, "*"), 1 , "*") ; Returns "aaaaaaaaaa"
User avatar
NicTheQuick
Addict
Addict
Posts: 1227
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

Re: StringField Bugs PB573

Post by NicTheQuick »

Why do you post it again? You got all the explanation already here: viewtopic.php?f=13&t=77182
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
Olli
Addict
Addict
Posts: 1071
Joined: Wed May 27, 2020 12:26 pm

Re: StringField Bugs PB573

Post by Olli »

Saki needed two versions of explanations. :lol:
It is a new technic to be sure !
As we participate per wave in the world, depending of the days and nights of everybody, I suppose he will ask a third version of the question in three hours ! :mrgreen:
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: StringField Bugs PB573

Post by Saki »

They say there are no stupid questions, only stupid answers :wink:

I'm sorry I haven't had time to deal with the latest postings.
there are still other things to do.
As I wrote, I still have to look at it, because at the time was really more important things to do.

I have already found and reported many bugs.
Now I made a mistake, shame on me.
But we will survive this too.
I don't have to report bugs, I don't have to share new codes, no problem. :mrgreen:
地球上の平和
User avatar
mk-soft
Always Here
Always Here
Posts: 5405
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: StringField Bugs PB573

Post by mk-soft »

I do not make mistakes. It just needs a little tweaking sometimes :mrgreen:
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: StringField Bugs PB573

Post by Saki »

Yes, it's just annoying.
I invest a lot of timein this things, give away codes in which an infinite amount of work was invested
and then I have to listen to stupid comments for every shit.

Who makes a lot, makes many mistakes, who makes nothing, makes no mistakes.

The time comes when you decide not to make any more mistakes in the future.
地球上の平和
User avatar
HeX0R
Addict
Addict
Posts: 992
Joined: Mon Sep 20, 2004 7:12 am
Location: Hell

Re: StringField Bugs PB573

Post by HeX0R »

Saki wrote:The time comes when you decide not to make any more mistakes in the future.
Is that the same time, where you decide to re-enter the board as Walsaki or Sabus? :twisted:

Seriously:
You made a quite stupid mistake, that happens!
Learn to live with a little mockery now
User avatar
skywalk
Addict
Addict
Posts: 3999
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: StringField Bugs PB573

Post by skywalk »

Saki - please don't stop contributing :!:
Only coders make mistakes.
Critics must wait for something to critique.
So, choose the quality of code wisely.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Olli
Addict
Addict
Posts: 1071
Joined: Wed May 27, 2020 12:26 pm

Re: StringField Bugs PB573

Post by Olli »

What it is sure is, a string text filter has lots of combinations.
StringField() just cut a source string with a delimiter string, and its index is one-based (1, 2, 3, ...), but not zero-based (0, 1, 2, ...).
Now if you use the delimiter string to mark your source string ("_ ... ... _"), the consequence seems to be strange, because its index becomes two-based (2, 3, 4, etc...)

"_monday_tuesday_wednesday_"

2 : monday
3 : tuesday
4 : wednesday

So, do not attach yourself to the remarks, and I think if we do such these remarks, it is because we are sure it is strange to manage a two-based index in this way. Strange but right even.
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: StringField Bugs PB573

Post by Saki »

Well, thank you very much, we'll see.

The thing with the string field has its pitfalls.
It is squite difficult to code this function.


Here a PB based alterable version
It's just a bit different :wink:

viewtopic.php?f=12&t=77198
地球上の平和
BarryG
Addict
Addict
Posts: 3324
Joined: Thu Apr 18, 2019 8:17 am

Re: StringField Bugs PB573

Post by BarryG »

Saki wrote: Wed May 05, 2021 4:29 pmThe thing with the string field has its pitfalls.
It is squite difficult to code this function.
What's an example pitfall? It's a very simple and clear command to use. You can't make claims like that with no reason. All I've seen so far is just coding errors by you when using it (sorry to say).
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: StringField Bugs PB573

Post by Saki »

Try to create a working code.
Then you will quickly find the pitfalls.

You can post it here then :wink:

When you've done that, i be happy to talk about it again.

You will fail (sorry to say).
地球上の平和
BarryG
Addict
Addict
Posts: 3324
Joined: Thu Apr 18, 2019 8:17 am

Re: StringField Bugs PB573

Post by BarryG »

Saki wrote: Wed May 05, 2021 9:55 pm Try to create a working code.
Then you will quickly find the pitfalls.
I've got lots of use of StringField() in my apps and they've never had any pitfalls. The onus is on you to demonstrate any problems with it, since you're the one claiming it has flaws. I've not seen one demonstrated flaw from you yet. Even your "bug" report about it was just incorrect coding by you. Sorry, but that's the reality and you need to face it.
Post Reply