Length of numeric string
When generating an accountId - I append a numeric onto the end of a derived string.
I need to determine the overall length of the accountId because I have a size limit. However, when I try to get the length of a numeric string (like "17") I get 0 - see the following trace.
<set name='numericLength'>
<length>
<ref>numeric</ref> -->17
</length> -->0
</set> --> null
couldnt you concat your numeric value with a single character string and then
subract 1. I believe XPRESS converts integers to string equivalents when doing "string" type manipulations.
i.e.
get your integer value in variable numeric
<set name='numericLengthplus1'>
<length>
<concat>
<s>0</s>
<ref>numeric</ref>
</concat>
</length>
</set>
set name='numericLength'>
<sub>
<ref>numericLengthplus1</ref>
<i>1</i>
</sub>
</set>
Similar Messages
-
Ok, I understand about numeric string formating (NumberFormat). But what I need help with is string formatting.
For example, I'm working on an app with fixed-length records. Let's take a name field. I need the string "John Doe" formatted to a 40-character field, right-justified. Can someone point me to a class or a URL with information on this.
Sorry for asking such an elementary question.Ok, I understand about numeric string formating
(NumberFormat). But what I need help with is string
formatting.
For example, I'm working on an app with fixed-length
records. Let's take a name field. I need the string
"John Doe" formatted to a 40-character field,
right-justified. Can someone point me to a class or a
URL with information on this.In the JDK I found nothing, but in the jakarta-Projekt of apache.org:
http://jakarta.apache.org/commons/lang.html
There is a class called StringUtils.
You only have to write:
String rightJustified = StringUtils.rightPad("John Doe", 40);
If you don't find something in the JDK look at Jakarta. They have a lot of useful stuff. -
Ascii value of a non numeric string literal
hi,
i would like to get the ascii value of a non numeric string
having special characters from extended ascii set.
for example i have a user id "J��o M��" and i want to get the ascii value of each character in this string.
(There are special characters having ascii value more than 127, present in string literal)
if you know some methods to do that ??
thanksUse charAt(i) to give you each char in the string. A char is also the numeric value of the character: note that there's no such thing as "extended ASCII" -- ASCII is the first 128 characters of Unicode, and Java uses Unicode characters.
String str = "Hello";
for (int i = 0; i < str.length(); i++)
System.out.println((int) str.charAt(i)); // cast to int so the char is displayed as a number -
How is the length of a string calculated in Java? and JavaScript?
Hi all,
Do any of you know how the length of a string is being calculated in Java and JavaScript? For example, a regular char is just counted as 1 char, but sometimes other chars such as CR, LF, and CR LF are counted as two. I know there are differences in the way Java and JavaScript calculate the length of a string, but I can't find any sort of "rules" on those anywhere online.
Thanks,
YimWhat's Unicode 4 got to do with it? 1 characteris 1
character is 1 character.
strings now contain (and Java chars also) is
UTF-16 code units rather than Unicode characters
or
code points. Unicode characters outside the BMPare
encoded in Java as two or more code units. So it would seem that in some cases, a single
"character" on the screen, will require two charsto
represent it.So... you're saying that String.length() doesn't
account for that? That sux. I don't know. I'm just making infrerences (==WAGs) based on what DrClap said.
I assume it would return the number of chars in the array, rather than the number of symbols (glyphs?) this translates into. But I might have it bass ackwards. -
Length of a string in a combobox exceeds the width of the combobox
How do you fix this:
The length of a string in a combobox exceeds the width of the combobox and as a result, the comboBox changes its size :-(
I don't want it to change the size even if the length of the string exceeds the width of the comboBox
what should i do?ok i got it
Dimension d =combo.getPreferredSize();
combo.setPreferredSize(new Dimension(50, d.height));
anyone with better solution? -
How to find the total length of the string drawed in a rect?
Hello Everybody,
I am drawing a string in on one rect using drawInRect method. This drawInRect method gives us a return value as size of the rect. I need length of the string that is did draw in that rect, but didn't find any api to do this.
Can anyone tell me , how find the length of the string which we did draw in rect?
Any help regarding this issue , is highly appreciable.
Thanks,
PanditHi Adreas,
First of all, very thanks for the response.
Actually , I am looking for other thing. Using drawInRect method I am drawing contentString in self.rect like below.
//code
[contentString drawInRect:self.rect withFont:[UIFont fontWithName:@"Verdana" size:14.0] lineBreakMode:UILineBreakModeWordWrap alignment:UITextAlignmentLeft];
//End
My contentString is much larger string, so I am not able to draw it in rect(length: 320.0 height: 460.0) completely. My rect is showing only a part of a contentString. So I need to get that part of string which did draw in the rect, so that I can process my contentString to get the remaining string to draw it a next rect.
The above code statement is returning me the CGSIZE , it is giving the size of the rect but not giving any information of the string which get draw in that rect.Do you have any idea how to do this?
Any information on this is highly appreciable.
Thanks,
Pandit -
Length of a string without using any built-in functions
code that returns the length of a string without using any built-in functions.
thanks
SamA string is internally represented by a character array. An array of characters will reside on the stack, not the heap. Yes, we always learned that String is a reference type, but what goes on in your memory might still surprise you...
A struct is internally represented by only it's private properties, sequentially on the stack.
So basically, what I thought is happening by messing with the structlayout: is only tricking our programming a bit into thinking that the top X bytes on the stack represent a chararray, while actually we put them there as a string.
Wrong. True. And wrong.
A string is internally represented by, in that order, an array length, a string length, the chars. None of them resides on the stack.
An array is internally represented by, in that order, an array length and the chars. None of them resides on the stack.
When you use the FieldOffset attribute to handle the string as a char array, you don't get anything right:
- the Length returned is the "array length" of the string, which is equal to the string length + 1.
- the chars returned by the array indexer are shifted by 2 chars (the length of the "string length" field).
You can use the FieldOffset to make that work, but it needs a little bit more work.
unsafe static int Test()
string myString = "This string may contain many string inside this string";
string testString = "string";
int countResult = 0;
fixed (char* myChars = new StringToChar { str = myString }.chr, testChar = new StringToChar { str = testString }.chr)
// The 2 first chars of the array are actually the string length.
int myCharsLength = myChars[1] << 16 | myChars[0];
int testCharLength = testChar[1] << 16 | testChar[0];
for (int i = 0; i < myCharsLength - testCharLength + 1; i++)
if (myChars[i + 2] == testChar[2])
for (int j = 1; j < testCharLength; j++)
var c = testChar[7];
if (myChars[i + 2 + j] != testChar[j + 2])
goto endOfCharAnalyses;
countResult++;
endOfCharAnalyses:
continue;
return countResult; -
Length of the string passed to rwcgi60 in Oracle 6i
Hello,
I am running the report from the web. The url will be something like
http://localhost/cgi-bin/rwcgi60.exe?server=repserver+report=.rep+all the input parameters.
When the length of the string passed from report= execeeds certain limit(indicated by dashes) I am getting the cgi error
Error: The requested URL was not found, or cannot be served at this time.
Oracle Reports Server CGI - Unable to communicate with the Reports Server.
If I remove some of the select criteria then I could execute the report from the web.
Any body has any soln. for this.
Thanks in advance,
Vanishri.Vanishri
The limit is very high and you should not be hitting this problem. There are couple of fixes done in this area. Please apply the latest patch (Patch 10) and try.
Other solution is you can have a mapped key in cgicmd.dat file and use the key alone in the URL. In the cgicmd.dat file, you have to map say
key1: REPORT=your_report.rdf USERID=user_name/password@mydb DESFORMAT=html
SERVER=repserver DESTYPE=cache
Please refer to the Publishing reports or Reports services manual at http://otn.oracle.com/docs/products/reports/content.html
Thanks
The Reports Team -
PowerShell: Want to get the length of the string in output
Hi All,
I am typing this but it is not working. Does anyone know what I could be doing wrong.
The command I wrote is:
GCI -file | foreach {$_.name} | sort-object length | format-table name, length
But it is not working. I am expecting a name of the file and length of the string like 8 characters etc. my file is called mystery so it should have 7 as its output of the name, length.
Thank-you
SQL 75Get-ChildItem supports both -File and -Directory.
Help will help:
https://technet.microsoft.com/library/hh847897(v=wps.630).aspx
Read the first couple of parameters to see.
GCI -file | sort-object length | format-table name, length | ft -auto
Seems to be a rasher of bad answers to day. YOu were just extracting the name property then trying to sort on a property that doesn't exist.
Do the sort first then select the properties.
it helps to test answers before posting. I know because I get bit by posting without thinking to often. I have to remember to think first.
¯\_(ツ)_/¯ -
Variable length declaration in string type
hi all
can anyone tell me how to declare length for string type of variablesHi,
The length of a string is not static but variable and adjusts itself to the current field content at runtime. Dynamic memory management is used internally. Strings can have any length. The initial value of a string is an empty string with length 0.
Hope this will make you clear. Please reward if answer satisfy you !!!
Regards,
Jignesh -
How to calculate the length of a string
Hi everyone,
A simple question. How to calculate the length of a string?
Thanks!Hi Wuyia Nata,
As everyone has suggested you search the forum before posting a question, i guess for basic questions u never have to post a question, you will get the answer in your search. Anyways see the code below for string lenght.
Data:
w_string type string,
w_lenght type i.
w_string = 'vhdskbvsdkbvdsvnsknvs'.
w_lenght = strlen( w_string ).
Write:
w_lenght.
With luck,
Pritam. -
Hi,
I have one parameter on the selection screen, when i enter some string on that, it should give me the length of the string. can you pls send me the code.
Ex: if i enter : enter amount : then it should give the o/p is: 12
Akshitha.use FM
SWA_STRINGLENGTH_GET
enter your string in EXPRESSION and use the others if needed use "X" for all three except EXPRESSION
EXPRESSION GFFHG
<b>CONDENSE_NO_GAPS
CONDENSE
WITH_LEADING_BLANKS </b>
also see STRING_LENGTH
STRING_LENGTH
Message was edited by:
Amit Singla -
Numbers: Text to numerical string - Made easy?
How can I convert/transform numbers that are in text format to a numerical string, in order to use functions, e.g. SUM, MEAN etc?
Thanks!
P.S. I have read the manuals and tried everything "obvious".Assuming that your numeric strings are in column B, in cells of column C insert the formula :
=VALUE(B)
As it's written in iWork Formulas and Functions User Guide
The VALUE function returns a number value even if the argument is formatted as
text. This function is included for compatibility with tables imported from other
spreadsheet applications.
So, the values in column C are numeric ones which may be summed as you may see in the footer cell C22
=SUM(C)
Yvan KOENIG (VALLAURIS, France) mercredi 17 août 2011 19:45:32
iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.0
My iDisk is : <http://public.me.com/koenigyvan>
Please : Search for questions similar to your own before submitting them to the community
To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer ! -
Check numbers in alpha numeric string
Hi All
Is there any direct command or function module which will find numbers in alpha numeric string or it will check that the string contains only numbers ?
Regards
Yogeshhi,
data: fvalue(4) type c,
nvalue(4) type n.
fvalue = 'ABC1'.
nvalue = fvalue.
if fvalue cn nvalue .
message i000(zz) with 'fvalue contains not Only numbers'.
else.
message i000(zz) with 'fvalue containsOnly numbers'.
endif.
Regards,
Sailaja. -
Extract numeric string in string
I want to extract numeric string from astring.
it should stop reading if it hits an alphabet that is requirement.it is not that numeric string is of fixed lenght but it will be in begining.
example:78965rocksalt
result:78965.Hi,
use fm PREPARE_STRING
DATA zahl(11) VALUE ' 0123456789'.
CALL FUNCTION 'PREPARE_STRING'
EXPORTING
i_valid_chars = zahl
i_xvalid_check = 'X'
i_xchar_repl = 'X'
i_xtoupper = 'X'
CHANGING
c_string = example.
CONDENSE example NO-GAPS.
result = example.
Andreas
pls reward useful answers
thank you
Maybe you are looking for
-
PDFs display and print fine in Acrobat but not in Preview of PDFPenPro
I have a curious problem in that check boxes in certain PDF files (insurance applications) appear as a "p" instead of a check box when I view the file in Preview or PDFPenPro. The check boxes appear and print properly when I open the PDF in Acrobat.
-
Skype account keeps disconnecting after 30 seconds
hi guys, its driving me nuts. my skype account keeps disconnecting after 30 seconds and i haven't even done anything. it does it on windows, and on my iphone too. what's going on? is this a problem with skype? i've seen similar posts. and i'm usin
-
When I try to boot I get stuck with a blue screen. It won't boot up properly. How can I fix this? I tried to press the blue button but nothing happened. When should I press it? What am I doing wrong? I have Vista Business on x61s. Before I got the bl
-
My iphone was stolen yesterday. A few weeks ago I enabled iCloud in my settings, but I don't know if the iCloud account was created properly and if my photos were saving to the photo stream or not. Is there any way I can retrieve the photos taken sin
-
How can I get a replacement Tiger CD for a Powerbook G4?
We obtained an old Powerbook G4 (NOT Intel) specifically to run HyperCard under Classic mode. The Powerbook is currently running 10.3 (Panther) and we want to upgrade it to Tiger (10.4.11). Tiger seems to be able to support almost all websites, but P