Jump to content
Janilabo

StrExplode (2 methods)

Recommended Posts

Rewrote my ancient Explode() function (just for fun).

 

Functions [A & B] below, with small example/test:

 

function StrExplodeA(d, str: string): TStrArray;
var                       
 p, i, l: Integer;
begin
 l := Length(d);
 SetLength(Result, Length(str));
 repeat
   p := Pos(d, str);
   if (p > 0) then
   begin      
     Result[i] := Copy(str, 1, (p - 1));
     Delete(str, 1, ((p + l) - 1));         
     Inc(i);
   end else
     Result[i] := Copy(str, 1, Length(str));
 until (p = 0);
 SetLength(Result, (i + 1));
end;

function StrExplodeB(d, str: string): TStrArray;
var                       
 o, p, i, l, x: Integer;
begin
 l := Length(d);
 x := Length(str)    
 SetLength(Result, x);
 o := 1;
 repeat
   p := PosEx(d, str, o);
   if (p > 0) then      
     Result[i] := Copy(str, o, (p - o))
   else
     Result[i] := Copy(str, o, ((x - o) + 1));
   o := (p + l);
   Inc(i);
 until (p = 0);
 SetLength(Result, i);
end;

var
 str: string;
 f: Integer;
 TSA: TStrArray; 

begin
 ClearDebug;
 f := OpenFile(Replace(AppPath, 'bin\', '') + 'changelog.txt', False);
 ReadFileString(f, str, FileSize(f));
 CloseFile(f);                                            
 f := GetSystemTime;
 TSA := StrExplodeA(#13#10, str);
 WriteLn('StrExplodeA: ' + IntToStr(GetSystemTime - f) + ' ms. [' + IntToStr(High(TSA)) + ']');
 SetLength(TSA, 0);
 f := GetSystemTime;
 TSA := StrExplodeB(#13#10, str);
 WriteLn('StrExplodeB: ' + IntToStr(GetSystemTime - f) + ' ms. [' + IntToStr(High(TSA)) + ']');
 SetLength(TSA, 0);                                                                            
 f := GetSystemTime;
 TSA := Explode(#13#10, str);
 WriteLn('Explode: ' + IntToStr(GetSystemTime - f) + ' ms. [' + IntToStr(High(TSA)) + ']');
 SetLength(TSA, 0);
end.

Link to comment
Share on other sites

Nice job. How did u get VIP anyways haha? do u buy it?

 

Donations might push Freddy to give you VIP. But Janilabo is more than just that. He's been around for a long time on the different scar forums. He probably joined around 2006 or so? W/e.

 

Looks cool Jani. Wish I could figure out half your functions. One day I will sit down and try to figure some more out xD

 

Also...I think without Jani SCAR wouldn't be how it is today. He donated big time and in more ways than just money too...

Link to comment
Share on other sites

Donations might push Freddy to give you VIP. But Janilabo is more than just that. He's been around for a long time on the different scar forums. He probably joined around 2006 or so? W/e.

 

Looks cool Jani. Wish I could figure out half your functions. One day I will sit down and try to figure some more out xD

 

Also...I think without Jani SCAR wouldn't be how it is today. He donated big time and in more ways than just money too...

Heh thanks for cheering me mate.. :P You made my day!

 

But yeah, I have been around these SCAR-related communities since summer 2004 (thats when Reines invited me to join ReiNet & RSCheatNet), I also lurked at Kaitnieks without registering for almost half year, before I finally registered there December 2004. I used "LaBo" as my nick for all those 3 ancient communities, but I wasn't ever all that active, I think at Kaitnieks.com my post count was around 100-150 (or something like that).. Just like I am not even these days so active (good example is my post count here, without all these functions etc in Code Bin), but thats who I am, it's my personality really.. I am a pretty quiet guy in real life too.

 

Communities that are still alive and where I am registered to: Freddy1990.com, Moparisthebest & SRL-Forums.

 

Also LJ; you are already catching me up everyday - bit by bit! Soon you'll be kicking my butt! ;)

+You have to remember, we all have our strong/weak fields.. I think my strong field would be these string handling things, no idea why.. :D Where as my weak part can be found from creating bigger scripts/projects, for some reason I usually lose my motivation with em (MSSL could be an exception, I have sticked with it for good amount of time by now).

-Jani

Link to comment
Share on other sites

Heh am i that inspirational? Jk.

 

If you think you fail at big projects, you're building the house and all the parts fit together and effect each other. MSSL is a such a small project Jani, no wonder you have no post count :P. Nah I can't even go through one part of MSSL without going over to the mssl forums and spazzing about what does what.

 

MSSL is titanic in size, it just needs to miss the no explanation glacier so I can dive into it more. ahaha some word play :D

 

[scar]but thats who I am, it's my personality really.. I am a pretty quiet guy in real life too.

 

[/scar]

 

scar noms on that statement...

 

Woot Jani! Cheers for 8 years+ of your commitment to this!

Link to comment
Share on other sites

Sports Betting: A Comprehensive Guide

Sports betting has become a global phenomenon, captivating millions of enthusiasts with its blend of excitement, strategy, and the potential for financial gain. This article aims to provide a comprehensive overview of sports betting, exploring its history, popular types, strategies, and the legal landscape.

A Brief History

Sports betting dates back to ancient civilizations, where wagers were placed on events such as chariot races and gladiatorial contests. Over the centuries, the practice evolved, encompassing a wide range of sports and becoming a formalized industry in the modern era. Today, sports betting is a multi-billion-dollar industry with a substantial presence both online and offline.

Types of Sports Bets

There are several types of bets that one can place on sports events, including:

1. Moneyline Bets: The simplest form of betting where you pick the winner of a game or match.
2. Point Spread Bets: This bet involves predicting the margin of victory.
3. Over/Under Bets: Also known as totals, these bets are placed on the total number of points scored by both teams combined.
4. Prop Bets: These are bets on specific outcomes within a game, such as the first team to score.
5. Futures Bets: Bets placed on events that will happen in the future, like who will win the championship at the end of the season.

Strategies for Successful Betting

Successful sports betting requires more than just luck. Here are some strategies to consider:

1. Research and Analysis: Study the teams, players, and historical performance data http://downzone.pl/profile.php?lookup=4971
2. Bankroll Management: Set a budget and stick to it, avoiding the temptation to chase losses.
3. Understanding Odds: Learn how to read and understand betting odds to make informed decisions.
4. Shop for the Best Lines: Different sportsbooks offer different odds and payouts, so shop around for the best deals.

The Legal Landscape

The legality of sports betting varies around the world. In some countries, it is fully legalized and regulated, while in others, it is either restricted or outright banned. The advent of online sportsbooks has also added a layer of complexity, as bettors can now place wagers from pretty much anywhere, often bypassing local regulations.

Conclusion

Sports betting continues to grow in popularity, attracting a diverse audience from casual fans to hardcore enthusiasts. With the right approach, including diligent research and disciplined bankroll management, it can be both an exciting and rewarding venture. However, it's essential to understand the risks involved and to always gamble responsibly.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...