Raised This Month: $51 Target: $400
 12% 

Combine two strings into one string


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Luigi Thirty
Junior Member
Join Date: Jul 2008
Old 07-27-2008 , 18:07   Combine two strings into one string
Reply With Quote #1

I'm trying to make a radio plugin, but I'm stuck. I've got two strings, musicBaseURL and musicAddURL. I need to put musicAddURL on the end of musicBaseURL and write that to musicNewURL.

Code:
musicNewURL[199] = StrCat(String:musicBaseURL[100], 200, String:musicAddURL[99]);
Doesn't work, and I can't figure out how to do it or if I'm even using StrCat right.
Luigi Thirty is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 07-27-2008 , 18:17   Re: Combine two strings into one string
Reply With Quote #2

StrCat(musicBaseURL, sizeof(musicBaseURL), musicAddURL);

This would put the whole url inside of musicBaseURL.
bl4nk is offline
Kigen
BANNED
Join Date: Feb 2008
Old 07-27-2008 , 22:23   Re: Combine two strings into one string
Reply With Quote #3

You problem is overuse of brackets. ( [] )

Code:
StrCat(musicBaseURL, sizeof(musicBaseURL), musicAddURL);
StrCat adds musicAddURL to musicBaseURL.
Kigen is offline
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 07-28-2008 , 05:22   Re: Combine two strings into one string
Reply With Quote #4

Plus functions can't return strings in Pawn, hence why they use buffers.
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.
DJ Tsunami is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 07-28-2008 , 14:03   Re: Combine two strings into one string
Reply With Quote #5

Also, if you want it to all be put inside of a different string (like it seems you're trying to do in your first post), you can always do this:

Code:
Format(musicNewURL, sizeof(musicNewUrl), "%s%s", musicBaseURL, musicAddURL);
..and then it will be stored in musicNewURL.
bl4nk is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:53.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode