REPLACE STRING IN STRING

Hello!

I use SQLANY 5.5.05 and loking for one function which will do following:

find string in string and replace it with another string.

In version ASA 6 I found function STUFF which I think do something like
this.
Is there anything in 5.5.05?

Regards

Tomaz


0
Tomaz
9/14/2000 8:42:24 AM
sybase.sqlanywhere.general 32637 articles. 22 followers. Follow

1 Replies
1153 Views

Similar Articles

[PageSpeed] 4

Try this:

create function
ReplaceString(in str long varchar,in old_substr char(255),in new_substr
char(255))
returns long varchar
begin
  // Change all occurrences of old_substr to new_substr in str.
  declare start_pos integer;
  declare found_pos integer;
  declare new_str long varchar;
  set new_str='';
  set start_pos=1;
  set found_pos=locate(str,old_substr,start_pos);
  while not found_pos=0 loop
    set
new_str=new_str||substr(str,start_pos,found_pos-start_pos)||new_substr;
    set start_pos=found_pos+length(old_substr);
    set found_pos=locate(str,old_substr,start_pos)
  end loop
  ;
  set new_str=new_str||substr(str,start_pos);
  return new_str
end;



"Tomaz" <tomaz.kralj@tpv-jc.si> wrote in message
news:y4KuTliHAHA.161@forums.sybase.com...
> Hello!
>
> I use SQLANY 5.5.05 and loking for one function which will do following:
>
> find string in string and replace it with another string.
>
> In version ASA 6 I found function STUFF which I think do something like
> this.
> Is there anything in 5.5.05?
>
> Regards
>
> Tomaz
>
>


0
Jon
9/14/2000 8:48:17 AM
Reply:

Similar Artilces:

Replace asterisk(*) in string with String.Replace
Hi All, string FirstName = "James *"; FirstName = FirstName.Replace("*", "").Trim(); My desired output is "James" while the above code actually output "James *". Is it there is some tricks to replace an asterisk(*) character within a string? Thanks Check the below code    string test = "James *";   Response.Write(test.Replace("*"," ").TrimEnd()); HCHaissam Abdul MalakMCAD.NET| Blog | Hi stardust25, Your code is correct and It should work.   Hope this helps,  www.stockbiz.vnThe Vietnamese Stock Market and Economy Thanks both, I just...

when using replace only replace the string if another string replacement takes place
Hello, Im using the string function to allow people to post images on my message board. im using the code below:         message = message.Replace("[img]", "<img src='");        message = message.Replace("[/img]", "' />"); This works fine, but it causes problems if only the [img] is input and not the [/img]. Does anyone know if it is possible to only do the first string replace if the second one is also found? thanks The simplest way would be to first check that the closing [/img] tag exists, and then do the r...

string to string[]
Hi, I've got this code : string[] Params; string SQL = "SELECT * FROM T_MANAGEMENT_PAGES"; SqlCommand myCommand = new SqlCommand(SQL, myConnection); myConnection.Open(); SqlDataReader myReader = myCommand.ExecuteReader(); try { while (myReader.Read()) { Params_Type = myReader.GetValue(0).ToString(); } } catch { } finally { } myReader.Close(); My problem is to obtain Params_Type. But each time, it says : "impossible to convert '[object]' in 'string[]' &quo...

string() = string()
this code does not work (not instance of object) Dim Items(), Other() As String Items = New String() {"A","B","C"} Other = New String() {} Other = Items how can I get all the values ? angiras Hi, If I understand your requirement correctly, this should do it Dim Items() As String = {"A", "B", "C"} Dim Other(Items.Length - 1) As String Items.CopyTo(Other, 0) To more closely match you code above, but this will be less efficient Dim Items(), Other() As String ...

String and String[]
What will be the advantage of using myString: String[10] over myString: String Man wrote: > What will be the advantage of using > myString: String[10] > over > myString: String "String[10]" is a fixed-length, statically allocated, Ansi-based ShortString. "String" is a dynamic-length, dynamically allocated, reference counted, Ansi-based or Unicode-based (depening on Delphi version) Long string. Unless you absolutely need the static, fixed length nature of ShortString, such as in records that interact with external systems, you should stay ...

string and string[]
hello, whats the difference here between string and string[] thanks "string" denotes an item of type String "string[]" denotes an array of type String itemsThanks, EdMicrosoft MVP - ASP/ASP.NET Gracia mon ami...

String and string?
Hi guys, I was wondering the difference between small letter string type and a capital letter String type. Does anyone know about this? Highly appreciate for your answers! Thankz! The "proper" version is String, as it references the System.String class of the .NET Framework Class Library. The ability to use string is provided by C#, where it is an alias to String. Similarly, the "proper" version of an integer is Int32, as it references System.Int32.  The ability to use int is provided by C#, and the ability to use Integer is provided by VB.NET, and both int and Integer are aliases...

Replacing a string with an empty string
Hi,    Thanks for your help. It can work now . Now i have another problem. Now, I want to find the part that contains the word "cos" to replace it with " "(empty string). How do I do that? I used the InStr() but there is a problem which I cannot solved. Can someone please help? Thanks! Dim value As String         value = txtValue.Text.Replace(" ", String.Empty)         Dim i As Integer = 0         While True          &nb...

Any function that replaces all occurences of one string in a given string with another third string?
Is there any function that replaces all occurences of one string in a given string with another third string?(Something that works similar to REPLACE() in MS-SQL Server) If not, can anything similar can be worked out somehow using T-SQL? Thanks in advance Replacing single instances can be done with the stuff function. So multiple occurrences can be done with a while loop: declare @CR char (1) select @CR = char (13) -- Carriage Return ... while (exists (select * from #rules where ch...

a string in a string in a string in my code behind....
I know my title talk about code-behind, but this is really a client-side problem (and surely a newby one too, sorry about that).I have a javascript function that my make a little text appear when the onmouseover event of a link is activated.So, normally, if my link was inside my html code, it would be something like this:<a href = "whocare.com"  onmouseover="poplink('I want to test something');">test</a>BUT, for some reason, I have to write this part in code behind with the LiteralControl function....and that will give something like that:this.Controls.Add(new LiteralCo...

m_AVP As IDictionary(Of String, String) = New Dictionary(Of String, String) ,not defined?
   I am creating a usercontrol (ascx,ascx.vb)   I have used Imports system.Collections Imports system.Collections.Generic     Private m_AttributeValuePair As IDictionary(Of String, String) = New Dictionary(Of String, String)     But I am gettting an error “Type Dictionary is not defined”   And also I am getting intelisense to type the line But what is the reason for my error ? How can I get escape from the error ?         this error is not showing today  ...

finding a string and replacing with another string in xslt
How to find a string and replacing with another string in XSLT.Thanks Start from here:http://www.dpawson.co.uk/xsl/sect2/N7240.htmlhttp://www.dpawson.co.uk/xsl/sect2/StringReplace.htmlAnd see also this:Comparing and replacing stringsThanks,Teemu KeiskiFinland, EU...

How to Encrypt a String to a String?
Hi Folks,I’m using Triple DES to encrypt a string… the output of the encryption is a byte array.However, I want to store the encrypted result as a string in a SQL Database and not as a byte array.(The reason I want to store it as a string, is to be able to copy & paste the result to a standalone windows form application  to decrypt it...) I’ve tried taking the byte array, converting it into a string…And then reconverting it into a byte array for the decryption. This causes an error upon decryption…How can I convert the encrypted byte array into a string and back into a byt...

Detecting string in string
Hello I am not an advanced perl programmer and I do not have my books with me. I want to determine if a string is within a string and to not process the string if the string is found. Could someone please provide a simple sample. Thanks, Andrew On 2/22/07, andrewmchorney@cox.net <andrewmchorney@cox.net> wrote: > I am not an advanced perl programmer Have courage -- you'll get there someday! > and I do not have my books with me. That's what the perldoc command is for. > I want to determine if a string is within a string Do you want the index func...

Web resources about - REPLACE STRING IN STRING - sybase.sqlanywhere.general

File:Replace this image male.svg - Wikipedia, the free encyclopedia
to an image (e.g. you photographed or drew it yourself) and would like Wikipedia to use it, you must release it under a free copyright license ...

Facebook Replaces Payments Emails With API
Facebook announced that it is scrapping the emails that it sends to developers containing information about payments , replacing it with a payments ...

Facebook’s New Ads Power Editor Replaces the Bulk Uploader with a Streamlined GUI
This week, Facebook launched its new Ads Power Editor desktop software for buyers who work directly with a Facebook ads representatives. The ...

Face Morph HD - Change and Replace Head in Pic Frame Hole with Pencil Portrait Effects! on the App Store ...
Get Face Morph HD - Change and Replace Head in Pic Frame Hole with Pencil Portrait Effects! on the App Store. See screenshots and ratings, and ...

NASA just chose SpaceX to replace the Shuttle for flying astronauts
jurvetson posted a photo: Elon's design goal = "the safest, most advanced crew vehicle ever flown.” With seats for seven . First manned flight ...

How to replace Roland Juno 106 Voice Chip 80017A 1 of 2 - YouTube
Own a Juno 106? You might encounter a dying voice chip. In this 2 part vid series I explain how to fix this problem. Don't be afraid its really ...

Khurram Khan ‘is going to be very difficult to replace’ for UAE ahead of World Twenty20 qualifiers
The post-Khurram era starts when the UAE face the hosts Scotland in the opening fixture of the World Twenty20 qualifier. The national team have ...

Change of the Day: Canadian Town Wants to Replace Its ‘Land of Rape & Honey’ Motto
The town of Tisdale in Saskatchewan has had a very unfortunate slogan for the past 60 years, and they’re finally looking for a new one. Visitors ...

ASI helps Cloud wholesaler replace Cisco hardware with Brocade rentals
ARNnet ASI helps Cloud wholesaler replace Cisco hardware with Brocade rentals ARNnet Cloud Plus is transitioning from Cisco to Brocade hardware ...

Notable names floated to replace Georgie Gardner on Today
Two names have raised eyebrows within television circles as Channel Nine prepares to announce a replacement newsreader on its breakfast television ...

Resources last updated: 12/15/2015 9:07:56 AM