.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Pass index number and find the char in a string?

Posted By:      Posted Date: October 01, 2010    Points: 0   Category :Sql Server

How do i find the charactors in teh first index and the last index number of a string? 


View Complete Post

More Related Resource Links

How to use Regular Expression to find a particular pattern and its index in the string??



I need some help here. I have a document containing some string like the following:


Now what I need is that I need to extract this "BusinessGoal" which as you can see, is 32 characters ahead after "-" (hyphen) and change it's case to uppercase.

The real challange is that, This "BusinessGoal" should only be replaced only and only where there is "Ref-<any 32 characters>" before it and not all. So if I find something like TypeName = "BusinessGoal"  it will be simply ignored.

So how am I going to make that reg Ex. I think it would be a combination of Regex and String Api. 

Kindly help me out.

Thanks and regards



Fahad Ali Shaikh

Capture and pass "abc\xyz" as a string into my WCF method

Hi All, I am trying to implement WCF Method where client has to pass like "abc\xyz" as a string i have to capture it and pass to my method. I am not able to do it. In our application we can split the string  and we can do what ever we can do . but string comes from client site so who do i capture into my method. I am very much new in WCF. Could u please help me. Thanks Shekhar  

Find first word in string??

Hey I would like to ask does anyone know how I can find the first word in a  stringif my String = apple; cat; dog; horse  I would like to get the first word ... appleThank you for taking the time to help meI really appreciate this :)RegardsJake

Pass XSL "Currently Selected" Value via Query String

Hi, I have a DVWP with an ID column, that's connected to other webparts on the page to filter their values accordingly.   I also have a "Print" button that opens a custom ASP page that's essentially a print-friendly single item data view.  How do I pass the "selected item" value to the URL when a user hits the print button? I've already set up the "ID" parameter and filters on the target page, just need to know how to get the value info from the list ID field inserted into the URL upon button click.  Thanks in advance

How to pass a String and convert to xml

A Simple Query Pass to connection String 1 My Query is SELECT a.HD, a.HEAD, a.SH, a.SUBHEAD, a.TRK, a.TRACK, a.TGT, a.TARGET, a.PDC, a.DT_RELEASE, a.STATUS, a.COFROM V_HIERARCHY1 a   2,My Data is HD    HEAD    SH    SUBHEAD    TRK    TRACK    TGT    TARGET    PDC    DT_RELEASE    STATUS    COHR    HR    Rec    Records    Leave    Leave Records    HRL.0002    Quarterly Review    01.07.2010    04.07.2010    Planned    EdlinkHR    HR1    DB    Database    SAL    Salary    DDS.0001    Calculation of Monthly salary    08.08.2010    09.08.2010    WIP    EdlinkHR    HR    Rec    Records    Ind    Induction Records    HRI.0001    Completion of dossiers.    08.07.2010    10.07.2010    WIP    EdlinkHR    HR  

how to find multiline string literals (@"bla") in .cs files (C# sourses)

Hello, My app searches a key word over .CS file (C# sourse) and I want to exlude all string literals because of possability of appearance of key word within this string which is unwanted. I've already composed a regex for common strings - like this - string s = "bla \"bla\" bla" ; This is highlighted correctly by ((?<!(\\|@))".*?"(?<!\\")) But I can't fix up the case with multiline strings. For instance - string s = @"bla ""bla"" bla" ; or string s = @" bla ""bla"" bla" ; In such type of strings there is a rule - within strings can be quotes but only if they are doubled. These are correct examples - @"bla """"""""bla """""" bla" @""" bla """"bla bla" @""""" bla"" bla bla""" These are incorrect - @"" bla "" bla bla"" @"bla """ bla bla" I have some clues - I know how to catch even quantity of quotes - by this regex - ((?<!")("")*(?!")) how to catch odd quantity - ((?<!")"("")*(?!")) how to catch strings which have even quantity of quotes, ex

pass number of rows of Gridview to a javascript function

using vb.net/asp.net 2005.I need to pass the number of rows of the Gridview to a javascript function does anyone know how to do this?  thanks

find number of sundays between two dates using sql

can i find total number of sundays between two dates using sql? or total number of days between two days except sundays

Can't pass string to javascript function(unterminated string)

Hello,I have a problem. I can't pass string like this  ": Mar 15 2004 12:00AM  Refnr: 20040315!m>N0"to javascript function because I have symbols like these >, <, % ?tc.Situation:I have a Grid and I have column with DataItemTemplate,Within my dataitemtemplate I have <a href="javascript:void(0);"  onclick="ShowAccountStatementNote(document.getElementById('<%= lblHiddenNoteText.ClientID %>').value);" >                                                          Bekijken...                                                      </a><a href="javascript:void(0);"  onclick="ShowNote('<%# EncodeStringToHTML(Eval("Note")) %>');" > Notes </a>ShowNote function just show popup with text = NoteEncodeStringToHTML do Server.HtmlEncode(); But It doesn't help because even if we change text on server .... e.g. "dfdf%" convert to "dfdf&#37;"  anyway on client it becomes again "dfdf%" and problem still exists.On clien

How to pass string values to parameterized sql query in Clause?

Hi,I'm using parameterized sql query to get data from database string query = "Select * from employee where employee_city in (@value)";strign city ="'NewDelhi','Bangalore','Mumbai'";I'm using following code to achive thisDataSet ds = new DataSet();SqlConnection con = new SqlConnection("Server=localhost;....");SqlCommand cmd = new SqlCommand();cmd.CommandText =query;SqlParameter param = cmd.Parameters.Add("@value",SqlDbType.VarChar);param.Value = city;SqlDataAdapter dap = new SqlDataAdapter();dap.SelectCommand = cmd;dap.Fill(ds);But this is not giving the result.If run the query in SQLServer query window as "Select * from employee where employee_city in ('NewDelhi','Bangalore','Mumbai')", records are there.But the same query will not return any records from ADO.Net.How to solve this?Thanks,Ashokan

P/Invoke: char[] or string?

From a .NET Compact Framework (that's why coredll is used) code: [DllImport("coredll", EntryPoint = "RegCreateKeyExW", CharSet = CharSet.Unicode)]<br/> internal static extern int RegCreateKeyEx(<br/> uint key,<br/> char[] subKeyName, // or prefer string?<br/> int reserved,<br/> string className,<br/> int options,<br/> int samDesired,<br/> ref int securityAttributes,<br/> ref int result,<br/> ref int disposition); Both version seems to work (string and char[] ). Which advantages/disadvantages to they have? Which should I prefer? In the sample above string is used for className parameter but char[] for subKeyName which looks a bit strange for me.Programming is a kind of art but not all programmers are artists.

Marshal of C++ char[] to C# string

Hi guys, this is my problem. I have some C++ structure in unmanaged DLL. I need to use those structures in C#, in managed code.It seems all simple.... This is the C++ code of structures. Be careful to the structure "T__KRON_Struct_Error_Context" that is the structure that causes problems. ****************************  typedef char                    T__Char; typedef unsigned __int32        T__UInt32;  typedef enum {  KRON_ERR_SUCCESS       =1000,   KRON_ERR_RQC_DUPLICATED      =1601,  KRON_ERR_RQC_BAD_CONF_FILE     =1700, }T__KRON_Returned_Codes;  typedef struct {  T__KRON_Returned_Codes m__errorcode;  T__Char     m__errormessage[150];  T__Char     m__errorfile[256];  T__UInt32    m__errorline; }T__KRON_Struct_Error_Context; ***************************** My marshaling of structures in the C# Wrapper is the following:     [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential, CharSet = System.Runtime.InteropServices.CharSet.Ansi)]    public struct T__KRON_Struct_Error_Context    {        public T__KRON_Returned_Codes m__errorcode;        /// T__Char[150]        [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 150)]        public string m__errormessage;        /// T__Char[256]        [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.

How to find the Number of Tables Present in an XML File?

Dear All,Can any one let me know "How to find the number of Tables present in a XML Schema File"?Thanks and Regards,G.V.N.Sandeep

How to find the Sum of a definite number of elements in a hierarchy in a cube



I guess my Query is pretty simple, but I am very new to MDX so having a problem in formulating the same. I need to find out the top 10 members in my hierarchy on basis of a measure and then need to sum all the others in the Hierarchy as "All Others". To explain it in a bit of detail, Suppose I have a Geography Hierarchy containing Cities A, B,C...till Z. Now I want the population (measure) of the top 10 cities and in the 11th position I want the sum of all the rest cities (which are not counted in the top 10) for two years say 2010 and 2009 and then want the absolute difference of that as well. The result set should look like,


Extract number from string


How i extract 0 from " flag=0" OR "flag = 0".

These are string value.

Pass string to Javascript function from code-behind...



I'm trying to send a error message to a javascript function from code-behind, but it's not working. When the javascript is executed the output error is: [object Object]

Here's my Javascript:

function Error(error) 
            document.getElementById("<%= errorText.ClientID %>").innerText = error;

And my C#:

        textError = "This is not working!!!";

        ScriptManager.RegisterStartupScript(Page, this.GetType(), "Error", "javascript:Error('" + textError + "');", true);                

Even if i pass the string instead of the 'textError' variable i still get the same error :(

Can anyone help me?

find a string beetwen tag


hi guys

i have a string contain :

kasjbdfkjasbdf klsajdfl

ajbfk  <html> ... </html> ksadfksadfwie...

now i wnat to find string beetwen <html> tag

(with regex)

how i can do that?

tnx guys

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend