How to get a char from a String Class?
How to get a char from a String Class?
Use charAt(int index), like this for example:
String s = "Java";
char c = s.charAt(2);
System.out.println(c);
Similar Messages
-
How to get maximal value from the data/class for show in Map legend
I make WAD report that using Map Web Item.
I devide to four (4) classes for legend (Generate_Breaks).
I want to change default value for the class by javascript and for this,
I need to get maximal value from the class.
How to get maximal value from the data/class.
please give me solution for my problem.
Many Thx
Eddy Utomouse this to get the following End_date
<?following-sibling::../END_DATE?>
Try this
<?for-each:/ROOT/ROW?>
==================
Current StartDate <?START_DATE?>
Current End Date <?END_DATE?>
Next Start Date <?following-sibling::ROW/END_DATE?>
Previous End Date <?preceding-sibling::ROW[1]/END_DATE?>
================
<?end for-each?>
o/p
==================
Current StartDate 01-01-1980
Current End Date 01-01-1988
Next Start Date 01-01-1990
Previous End Date
================
==================
Current StartDate 01-01-1988
Current End Date 01-01-1990
Next Start Date 01-01-2005
Previous End Date 01-01-1988
================
==================
Current StartDate 01-01-2000
Current End Date 01-01-2005
Next Start Date
Previous End Date 01 -
How to get the message from a Runnable class
The Schedule class is actually a JFrame, what I want to do is to "get" the message from Scheduler Class and display it in a JTextField, to let user know what is doing.
How can I approach this?
public class Schedule {
@SuppressWarnings("static-access")
public static void main(String args[]) throws InterruptedException {
final Scheduler s = new Scheduler();
Thread t = new Thread(s);
t.start();
public class Scheduler implements Runnable{
private static int actionType;
private static String msg;
public static void setMsg(String msg) {
Scheduler.msg = msg;
public static String getMsg() {
return msg;
public void run() {
//System.out.println((int)(Math.random() * 1000));
actionType = 1;
while(true){
try {
switch(actionType){
case 1:
setMsg("Process actionType: "+actionType);
break;
case 2:
Thread.sleep(2000L);
setMsg("Process actionType: "+actionType);
break;
case 3:
Thread.sleep(2000L);
setMsg("Process actionType: "+actionType);
break;
case 4:
Thread.sleep(2000L);
setMsg("Process actionType: "+actionType);
break;
actionType++;
if(actionType>4){
actionType = 1;
} catch (InterruptedException ex) {
System.out.println("Scheduler.run:"+ex.toString());
}Or with only one loop:
int actionType = 0;
while (true)
actionType = (actionType % 4) + 1;
msg = "Process actionType: " + actionType;
try
Thread.sleep(2000L);
catch (InterruptedException ex)
System.out.println("Scheduler.run:" + ex.toString());
} -
How to get the subclass from a super class( or interface)
hi,
I want to get subclass from a super class (or a interface), how to do that? the subclass of a interface means the class implementing the interface.
for example;
List ls;
I want to get the subclass of ls, i.e., LinkedList, Stack, Vector......
AbstractList al;
the subclass of al, i.e., ArrayList, Vector.......
thanks
AiwuList ls = new ArrayList();Since ls has been declared as a List we can only use List methods
with it. This is a good thing because we might later want to change
it to some other sort of List.
I want to get subclass from a super class (or a interface), how to do
that?The instance of the subclass declared above did not really come
from the super class. A class "knows nothing" about its
subclasses: many sub classes would not even exist at the time
the class was written. -
How to get HTTP headers from Data Provider Class?
Hi,
I'm the beginner in SAP NetWeaver Gateway. Using Service Builder I created CRUD OData web service and implemented CRUD operations in Data Provider Class. Data Provider Class has methods like MYENTITY_GET_ENTITYSET, MYENTITY_GET_ENTITY, MYENTITY_CREATE_ENTITY, MYENTITY_UPDATE_ENTITY. How can I get HTTP headers from the methods of this Data Provider Class?You can do so by using the following code in DPC
Data : Lo_facade type ref to /IWBEP/IF_MGW_DP_INT_FACADE.
lo_facade ?= /iwbep/if_mgw_conv_srv_runtime~get_dp_facade( ).
lt_client_headers = lo_facade->get_request_header( ).
Regards,
Atanu -
How to remove empty char from a string
Hi,
In my code I should get numeric int numbers and convert them to 1 and 0 , concatenate thm to make an string ( 8 chars) . the problem I have is the empty chars as result of conversion from number to string
so lets say pxiAnaIn=1 dutVdd=2 and dutOut=5 so then the output should be 10110001 but now the output is 10110 1 . could you please let me know how can I fix this problem
thankstintin_99 wrote:
Hi,
In my code I should get numeric int numbers and convert them to 1 and 0 , concatenate thm to make an string ( 8 chars) . the problem I have is the empty chars as result of conversion from number to string
so lets say pxiAnaIn=1 dutVdd=2 and dutOut=5 so then the output should be 10110001 but now the output is 10110 1 . could you please let me know how can I fix this problem
thanks
You could make your life a little easier and only use 1 format string. Use "%03b%02b%03b" for the format string. You can then expand the format string to allow multiple inputs. You will do the job of 4 functions with just 1.
"%3b" just says to give 3 spaces for the binary number. But any preceding 0s will be turned into spaces. Adding the 0 in there tells the format string to prepend 0s instead of using spaces.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines -
How to get numeric data from a string using t-sql
Hi All,
I have a table with 2 columns ID as Int and Message as nvarchar(max)
Create table Sample
ID int not null,
Message nvarchar(max) null,
CONSTRAINT [PK_ID_Msg] PRIMARY KEY CLUSTERED
ID asc
Insert statement:
INSERT INTO
Sample (ID, Message)
VALUES (1, 'X_YRS: 00 ; X_MONS: 18 ; X_DAYS: 000 ; Y_YRS: 00 ; Y_MONS: 16 ; Y_DAYS: 011 ; Z: 1 ; Z_DATE: 09/04/2014
INSERT INTO Sample (ID, Message) VALUES (2, 'X_YRS: 01 ; X_MONS: 15 ; X_DAYS: 010 ; Y_YRS: 00 ; Y_MONS: 18 ; Y_DAYS: 017
; Z: 1
; Z_DATE: 06/02/2012')
Data in the table looks like:
ID Message
1 X_YRS: 00 ; X_MONS: 18 ; X_DAYS: 000 ; Y_YRS: 00 ; Y_MONS: 16 ; Y_DAYS: 011 ; Z: 1 ; Z_DATE: 09/04/2014
2 X_YRS: 01 ; X_MONS: 15 ; X_DAYS: 010 ; Y_YRS: 00 ; Y_MONS: 18 ; Y_DAYS: 017 ; Z: 1 ; Z_DATE: 06/02/2012
Need out put as below, just with numeric data:
ID X-Column Y-Column
1 00 18 000 00 16 011
2 01 15 010 00 18 017
So, please I need t-SQL to get above output.
Thanks in advance.
RH
sql;With CTE
AS
SELECT s.ID,RTRIM(LTRIM(STUFF(Val,1,CHARINDEX(':',Val),''))) AS Val,RTRIM(LTRIM(LEFT(Val,CHARINDEX('_',Val+'_')-1))) AS Pattern,
--ROW_NUMBER() OVER (PARTITION BY LEFT(Val,CHARINDEX('_',Val+'_')-1) ORDER BY RTRIM(LTRIM(STUFF(Val,1,CHARINDEX(':',Val),'')))*1)
f.ID AS Seq
FROM Sample s
CROSS APPLY dbo.ParseValues(s.[Message],';')f
WHERE ISNUMERIC(RTRIM(LTRIM(STUFF(Val,1,CHARINDEX(':',Val),'')))+'0.0E0')=1
SELECT ID,
STUFF((SELECT ' ' + Val FROM CTE WHERE ID = c.ID AND Pattern = 'X' ORDER BY Seq FOR XML PATH('')),1,1,'') AS XCol,
STUFF((SELECT ' ' + Val FROM CTE WHERE ID = c.ID AND Pattern = 'Y' ORDER BY Seq FOR XML PATH('')),1,1,'') AS YCol,
STUFF((SELECT ' ' + Val FROM CTE WHERE ID = c.ID AND Pattern = 'Z' ORDER BY Seq FOR XML PATH('')),1,1,'') AS ZCol
FROM (SELECT DISTINCT ID FROM CTE)c
ParseValues can be found here
http://visakhm.blogspot.in/2010/02/parsing-delimited-string.html
Numeric check logic is as per below
http://visakhm.blogspot.in/2014/03/checking-for-integer-or-decimal-values.html
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
How to get specific character from a string
I have a value such as: 0-5 or 123-30. This is a combination
from 2 different IDs.
All I need is to get the number on the right (5 from 0-5 OR
30 from 123), any number on the right of the "-" character not
including
the "-"
I'm not sure what ColdFusion function can I use safely.
I said safely since all I can find is either Left or Right
functions. With these 2 functions, I need to specify the number of
character to extract while in my case the application is growing so
the ID may currently be only 1 digit each (0-5) but later it may
grow longer (123-5677).
If anyone know the function, please help me. Thank you!Something like this?
Mid(string, Find("-",string)+1 ,
Len(string)-Find("-",string))
Since
Mid(string, start, count)
and
Len(string or binary object)
and
Find(substring, string [, start ])
Or perhaps ....
ListLast(string, "-")
since
ListLast(list [, delimiters ])
Phil -
How to get the VIEW_ID from VIEW Controller Class?
Hi,
In my BADI(CRM_BP_UIU_VIEW_CONFIG), I have a view controller variable(IR_VIEW_CONTROLLER) referring to CL_BSP_WD_VIEW_CONTROLLER. Now, I have to get VIEW_ID using this varibale. However, the VIEW_ID attribute is Protected in the class .CL_BSP_WD_VIEW_CONTROLLER So, I am unable to access this attribute.
Could you please help me out, how can I do achieve this?
Thanks,
SandeepSee if you can make use of GET_VIEWAREA_CONTENT or GET_VIEWAREA_CONTENT_ID...
Regards,
BJ -
How to get each value from a parameter passed like this '(25,23,35,1)'
Hi
One of the parameter passed to the function is
FUNCTION f_main_facility(pi_flag_codes VARCHAR2) return gc_result_set AS
pi_flag_codes will be passed a value in this way '(25,23,35,1)'
How to get each value from the string
like 25 first time
23 second time
35 third time
1 fourth time
I need to build a select query with each value as shown below:-
(SELECT t2.org_id, t4.description
from org_name t2, ref_org_name t3, code_table t4
where t2.att_data = t4.code
and t3.ref_code = t2.att_type
and t2.att_type = 25 and t3.code_type = t4.code_type
and to_date('01-JAN-10', 'DD-MON-YY') between t2.att_start_date AND t2.att_end_date) q1,
(SELECT t2.org_id, t4.description
from org_name t2, ref_org_name t3,code_table t4
where t2.att_data = t4.code
and t3.ref_code = t2.att_type
and t2.att_type = 23 and t3.code_type = t4.code_type
and to_date('01-JAN-10', 'DD-MON-YY') between t2.att_start_date AND t2.att_end_date) q2,
(SELECT t2.org_id, RTRIM(xmlagg(xmlelement(e, t4.description || ';')
ORDER BY t4.description).EXTRACT('//text()'), ';') AS DESCRIPTION
from org_name t2, ref_org_name t3,code_table t4
where t2.att_data = t4.code
and t3.ref_code = t2.att_type
and t2.att_type = 35 and t3.code_type = t4.code_type
and to_date('01-JAN-10', 'DD-MON-YY') between t2.att_start_date AND t2.att_end_date
group by t2.org_id) q3,
(SELECT t2.org_id, t4.description
from org_name t2, ref_org_name t3, code_table t4
where t2.att_data = t4.code
and t3.ref_code = t2.att_type
and t2.att_type = 1 and t3.code_type = t4.code_type
and to_date('01-JAN-10', 'DD-MON-YY') between t2.att_start_date AND t2.att_end_date) q4
Please help me with extracting each alue from the parm '(25,23,35,1)' for the above purpose. Thank You.chris227 wrote:
I would propose the usage of regexp for readibiliy purposes and only in the case if this doesnt perform well, look at solutions using substr etc.
select
regexp_substr( '(25,23,35,1)', '\d+', 1, 1) s1
,regexp_substr( '(25,23,35,1)', '\d+', 1, 2) s2
,regexp_substr( '(25,23,35,1)', '\d+', 1, 3) s3
,regexp_substr( '(25,23,35,1)', '\d+', 1, 4) s4
from dual
S1 S2 S3 S4
"25" "23" "35" "1"In pl/sql you do something like l_val:= regexp_substr( '(25,23,35,1)', '\d+', 1, 1);
If t2.att_type is type of number you will do:
t2.att_type= to_number(regexp_substr( '(25,23,35,1)', '\d+', 1, 1))Edited by: chris227 on 01.03.2013 08:00Sir,
I am using oracle 10g.
In the process of getting each number from the parm '(25,23,35,1)' , I also need the position of the number
say 25 is at 1 position.
23 is at 2
35 is at 3
1 is at 4.
the reason I need that is when I build seperate select for each value, I need to add the query number at the end of the select query.
Please see the code I wrote for it, But the select query is having error:-
BEGIN
IF(pi_flag_codes IS NOT NULL) THEN
SELECT length(V_CNT) - length(replace(V_CNT,',','')) FROM+ ----> the compiler gives an error for this select query : PLS-00428:
*(SELECT '(25,23,35,1)' V_CNT FROM dual);*
DBMS_OUTPUT.PUT_LINE(V_CNT);
-- V_CNT := 3;
FOR L_CNT IN 0..V_CNT LOOP
if L_CNT=0 then
V_S_POS:=1;
V_E_POS:=instr(pi_flag_codes, ',', 1, 1)-1;
else
V_S_POS:=instr(pi_flag_codes,',',1,L_CNT)+1;
V_E_POS:=instr(pi_flag_codes, ',', 1, L_CNT+1)-V_S_POS;
end if;
if L_CNT=V_CNT then
V_ID:=TO_NUMBER(substr(pi_flag_codes,V_S_POS));
else
V_ID:=TO_NUMBER(substr(pi_flag_codes,V_S_POS,V_E_POS));
end if;
VN_ATYPE := ' t2.att_type = ' || V_ID;
rec_count := rec_count +1;
query_no := 'Q' || rec_count;
Pls help me with fetching each value to build the where cond of the select query along with the query number.
Thank You. -
How to get Date Format from Local Object.
Hi All,
I am new to Web Channel.
I need to know Date format From date of locale.
suppose there is a date "01/25/2010" date in date field I want to get string "mm/dd/yyyy". Actually I have to pass date format to backend when I call RFC.
Is there any way to get Date format from "Locale" object. I should get date format for local object
I get local object from "UserSessionData" object but how to get Date format from it.
I am not looking for Date value. I am looking for current local date format ("mm/dd/yyyy or dd/mm/yyyy or mon/dd/yyyy) whatever local date format. I could not find example which show how to get date format from "Locale" object.
Any help will be appreciated with rewards.
Regards.
Web ChannelHi,
You can get it from "User" or "Shop" business object.
Try to get User or Shop Business Object as shown below.
BusinessObjectManager bom = (BusinessObjectManager) userSessionData.getBOM(BusinessObjectManager.ISACORE_BOM);
User user = bom.getUser();
char decimalNotation = user.getDecimalPointFormat().getGroupingSeparator();
If you are seeing "1,234.00" then above code will return "."
I hope this information help you to resolve your issue.
eCommerce Developer. -
How to get a formula from the user from a text box in a webpage
Hi. I would like to know how to get the formula from the user who enters in a textbox. This formula can have any number of variables starting with a and goes on.
The complexity of the formula can go upto sin, cos, ln, exp. Also user enters the minimum and maximum values of these variables. Based on a specific algorithm (which I use) I would calculate a *set of values, say 10, for each of these variables, substitute in the formula and based on the result of this formula, I select ONE suitable value for each of the variables.
I don't know how to get this formula (which most likely to be different each time) and substitute the values *which I found earlier.
Kindly help me out in this issue.
ThanksThe textbox is the easy part. It's no different than getting a String parameter out of an HTTP request.
The hard part is parsing the String into a "formula" for evaluation. You'll have to write a parser or find one.
Google for "Java math expression parser" and see what you get.
Or write your own with JavaCC.
% -
How to get column value from DB grid
Hi!
I wander how to get col value from GridControl?
My app consists of one rowsetinfo with two
columns CODE and DESCRIPTION and a jbutton
titled SELECT. When user clicks SELECT button
the app should show the value of the CODE col
of the selected row in GridControl.
I wander how to make this action ?
XxpsTransTimesMasterIter.setAttributeInfo( new AttributeInfo[] {
CODEXxpsTransTimesMasterIter,
DESCRIPTIONXxpsTransTimesMasterIter} );
XxpsTransTimesMasterIter.setName("XxpsTransTimes");
XxpsTransTimesMasterIter.setQueryInfo(new QueryInfo(
"XxpsTransTimesMasterIterViewUsage",
"lov.XxpsTransTimes",
"CODE, DESCRIPTION",
"XXPS_TRANS_TIMES",
null,
null
));Hi,
You could attach an ActionListener on the JButton, and try the following code :
NavigationManager fm = NavigationManager.getNavigationManager();
DataItem dataItem = fm.getFocusedControl().getDataItem();
ImmediateAccess col_code = null;
String code = null;
if (dataItem != null && dataItem instanceof RowsetAccess) {
RowsetAccess rowset = (RowsetAccess)dataItem;
try {
col_code = (ImmediateAccess) rowset.getColumnItem("CODE");
code = col_code.getValueAsString();
} catch (DuplicateColumnException de) {
return;
} catch (ColumnNotFoundException ce) {
return;
} catch (SQLException se) {
return;
JTextField tf = new JtextField();
tf.setText(code);
I haven't tested this code.
I am curious to know, the Object type of the dataItem.If it doesnot happen to be RowsetAccess ..try.. ScrollableRowsetAccess OR ImmediateAccess.
Your code would change accordingly, depending on the instance.Refer to the product documentation for this.
Do let me know, if this works.
TIA
Sandeep -
How to get selected value from OADefaultListBean.
Hi All,
How to get selected value from OADefaultListBean ?
Thanks,Hi,
To identify the user's selection(s) when the page is submitted, you would add the following logic to your processFormRequest() method:
OADefaultListBean list =
(OADefaultListBean)webBean.findChildRecursive("positionsList");
String name = list.getName();
String[] selectedValues = pageContext.getParameterValues(name);
To retrieve all the values in the list box, call list.getOptionsData().
--Prasanna -
How to get attribute value from standard page ?
Hi,
How to get attribute value from standard page ?
String str = (String)vo.getCurrentRow().getAttrbute("RunId");
But this value is returning a null value ....
Can anyone help me to get this attribute value which is actually having a actual value .getCurrentRow() would always return null if no setCurrentRow() is used.
Please check the page design and understand how many rows of VO are there. You can also use the following to get the row:
vo.reset();
vo.next();
Regards
Sumit
Maybe you are looking for
-
How to sync Nokia 9300i & Address Book without loosing contacts data/labels
Hi, I have a Nokia comunicator 9300i and would like to backup the contacts in it (over 700) using a Mac. I can do that on the PC using Nokia's own backup suite. Yes, Nokia Comunicator 9300i is on the supported devices list and yes it does sync nicely
-
How do I reset my HP photosmart all-in-one B210a to print page 1 first?
My printer is apparently all set up, but I want to change the print sequence from reverse order to starting at page 1. I have the latest HP software installed, but there is no where I can see of changing the sequence. I have been in to System Prefere
-
I haven't made changes to my sound settings but suddenly now certain sounds do not work such when I plug up to change, keyboard clicks on messages, etc
-
Zenworks DLU Account Creation on Windows Server 2003 TS
We are a Novell shop running novell netware 6.5sp5, Metaframe Presentation Server v3.0 r03 running on a Windows server 2003 server with the novell client 4.91sp2, Zenworks 6.5sp2 desktop management client and a Citrix Web Interface 4.0 server providi
-
Black update for Lumia 520 in India
Nokia