473,946 Members | 2,266 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Middle of word

N9
Hi

It's possible to substring middle ??

text = "Here are a story about a boy, who like to play baseball"

I split on word "who", with 10 char to left and 10 char til right,
that the result gone be.

text = "out a boy who, like to "

Hope some one could help me.

Thanks

//N9
Jun 27 '08 #1
2 1346
N9 wrote:
It's possible to substring middle ??
Your example doesn't seem to have anything to do with XSLT, unless test
is an attribute.
Jun 27 '08 #2
N9 wrote:
Hi

It's possible to substring middle ??

text = "Here are a story about a boy, who like to play baseball"

I split on word "who", with 10 char to left and 10 char til right,
that the result gone be.

text = "out a boy who, like to "

Hope some one could help me.

Thanks

//N9
You should look up XPath rather than XSLT, and you will
want the string functions:

substring-before, substring-after, substring, string-length

and possibly 'concat' and 'contains'
for example:

substring(subst ring-after("Here is a story about a boy, who likes to
play baseball","who" ),4,11)

evaluates to 'kes to play'

Note that the second parameter is a request for a length od substring,
not the final position.

Assuming the source text is the content of an xml element, you would use
<xsl:value-of>, possibly normalise spaces, and almost certainly wish to
use a variable.

Also not thet the 'substring-before' and 'substring-after' functions
only return the first match,
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3544
by: ams | last post by:
A table contains records of Ice Cream flavors. There is a primary id field (INT) and a varchar for flavor. I need to get the row in the very middle of the table, however I can't assume that the table's primary id field will be entirely sequential across the table because some records may have been deleted. Say there are 10 records in the table and the last primary id is 24. I can't reliably devide 24 by 2 to assume the middle row is...
5
21566
by: Poonam | last post by:
Hi Can we align an image or content vertically middle in a DIV. tks poonam
4
3071
by: lindsey.crocker | last post by:
I have this links list with background images set on them which changes when they roll over. The <td> is set valign="middle" however as soon as you apply the rollover to the link, the text jumps to the top of the <td> instead of staying middle. I can not put padding on the top as some links are 2 lines and some are 1 line.
1
13689
by: Galina | last post by:
Hello I generate a pritty complicate report in my application. The report is so complicate in fact that I sort and format records in code, form a long string and assign it to an unbounded field on report. String presents course(s) information, like course code, location, time, when it runs and so on. I am asked, is it possible to have tab in front of course code. Tab and course code are added into the string in the following simple way:...
15
2757
by: Hi5 | last post by:
Hi, I am designing a database for a client in which It has a client table including the followings: 1-Table Client 2-Table lookupcategory 3-Table Ctegory
6
2265
by: Ian Williamson | last post by:
Greetings, My company has an ASP.NET based enterprise product that is undergoing some changes and I need some community input to help solve a problem. In the current implementation, any given installation of the product supports only one database at a time. The server/db information is stored in the registry on the computer hosting the com+ based middle tier. We are now moving to a solution which supports multiple databases. That...
2
3500
by: rhino | last post by:
I'm working on a layout that has a variable-height middle section and need some suggestions on how I can make the bottom section adapt to that situation. Basically, I have: - a fixed-length, fixed-width top section which is just a graphic - a fixed-width _variable_height middle section which contains two columns, an index on the left and main content on the right - a fixed-length, fixed-width bottom section which is mostly a graphic...
23
4394
by: Himanshu Chauhan | last post by:
Hi! I was wondering, In the first parse of a singly linked list of unknown length, is it possible to know when we are at middle of the linked list? Regards --Himanshu
4
7668
by: mdthom08 | last post by:
I need to return the middle 2 characters of a word, favoring the right. so for example: SevenMethods myFuns = new SevenMethods(); assertEquals("34", myFuns.middleTwo("12345")); so far i have: public String middleTwo(String arg) { int middle = arg.length() / 2; int middle2 = middle / 2;
0
10153
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9981
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11558
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
11334
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9886
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8248
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7423
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6111
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4533
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.