Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
StrTran() case insensitive
Message
De
07/07/2010 21:07:31
 
 
À
07/07/2010 17:23:49
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 9.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01471738
Message ID:
01471770
Vues:
29
>C# I'm afraid. Also assuming you want the same functionality as VFP with Flags=1:
public string StrTranInsensitive(string searchIn, string searchFor, string replace)
>        {
>            string result = searchIn;
>            int i = searchIn.ToLower().IndexOf(searchFor.ToLower());
>            if (i > 0)
>            { 
>                result = searchIn.Substring(0, i) + replace + searchIn.Substring(i + searchFor.Length);
>            }
>            return result;
>        }
Not really stress tested - may fall over easily but should be a starting point.....

Thanks
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform