How to ingore the , within ( ) when i do String.split(",")??
hi guys,
i am currently using java class to read CSV files.
my example code is
String str = dataFile.readLine();
String[] words = str.split (",");
i do not wish to take the , within brackets to be splitted up as in (today,tomorrow), after splitting them i still want them to stick as (today,tomorrow).
for example if the above String str is "(today,tomorrow),yesterday,nextday
after splitting i want the output to be:
(today,tomorrow)
yesterday
nextday
is it possible to do it? anyone help?? thanks!
Java does not have an API to do this, also its not fair to ask that. You may need to write your own code to do it. I think its simple as well.
First split on "," and then pass through the array and form the string if the string startswith "(" by appending the next strings untill u get a string which ends with ")".
VJ
Similar Messages
-
How to register the recipient when create job by function
I am now use JOB_OPEN , JOB_SUBMIT and JOB_CLOSE to create a job in the program. And need to post the result of the report to the person by email.
Can you tell me how to register the recipient when create the job.
( in sm36, it is easily to do but how to do in coding? )
regards,
slamHi
I think in Back ground using the above fun modules you can't send a mail to the receipient.
see the use of the above fun modules;
IF p_bjob = 'X'.
CONCATENATE sy-cprog sy-datum sy-uzeit
INTO jobname SEPARATED BY '_'.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = jobname
IMPORTING
jobcount = jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
IMPORTING
out_archive_parameters = arc_params
out_parameters = print_params
valid = valid
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
IF valid = chk.
SUBMIT ybrep
WITH < sel Screen>
AND RETURN
USER sy-uname
VIA JOB jobname
NUMBER jobcount
TO SAP-SPOOL
SPOOL PARAMETERS print_params
ARCHIVE PARAMETERS arc_params
WITHOUT SPOOL DYNPRO.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = jobcount
jobname = jobname
strtimmed = 'X'
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
invalid_target = 8
OTHERS = 9.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
MESSAGE i029 WITH jobname.
ENDIF.
ELSE.
MESSAGE s000 WITH text-003.
STOP.
ENDIF.
ENDIF.
Reward points if useful
Regards
Anji -
How to reload the screen when changing languages in JavaFX 2?
I'm beginner with javaFX and i need to change language of the screen. but i have no idea how to reload the screen when the language was changed. The application have a button where have the language available. I want just refresh screen when the user change language.
Here is the start method to show the stage.
@Override
public void start(Stage stage) throws Exception
this.stage = stage;
Locale locale = Locale.getDefault();
ResourceBundle rb = ResourceBundle.getBundle("resources/Label",locale);
loader = new FXMLLoader(getClass().getResource("FXMLDocument.fxml"),rb);
root = (Parent)loader.load();
FXMLDocumentController controller = (FXMLDocumentController) loader.getController();
controller.setMain(this);
scene = new Scene(root);
stage.setScene(scene);
stage.show();
here is the function to change the language(in the same class with start function),the rb is the new ResourceBundle:
public void refresh(ResourceBundle rb)
//change the language here
1. I don't want to use the resourceBundle to get value in resource file and set label in scene one by one.like following:
this.btnLabel.setText(rb.getString(key.test));
2. I don't want to reload the scene,like following:
public void refresh(ResourceBundle rb)
try
loader = new FXMLLoader(getClass().getResource("FXMLDocument.fxml"),rb);
root = (Parent)loader.load();
scene.setRoot(root);
FXMLDocumentController controller = (FXMLDocumentController) loader.getController();
controller.setMain(this);
catch(Exception err)
err.printStackTrace();
So do we have a solution to just set the resourceBundle and reload the scene easier?
Thanks and best regards!Your option 2 (reload the FXML for the scene using the new resource bundle as a parameter), is the way this would normally be done and what I would recommend.
Failing that, you could use option 1 of individually resetting the label text of labeled items (I don't really recommend this).
Why don't you want to use option 2?
Perhaps it is because there is some internal state of the UI which differs from the initial state when the the UI is first loaded (e.g. user has typed text in a text field and you want to preserve that). If that's the case you will need to either go with your option 1 of individually resetting the label text of labeled items, or implement something which preserves the UI state and user data by saving it in memory or to disk, reloading the UI via the FXMLLoader (essentially your option 2), then restoring the UI state and user data to what it was before the language change. Preserving and restoring the modified state seems complicated to me if you have a lot of state, so I wouldn't really advise this approach unless you really needed it. -
How can I watch movies in germany with native tone, english? Any one knows how to switch the language when renting a movie?
I wonder the Format Tables macros on my site could be adapted?
http://www.grainge.org/pages/authoring/word/word_macros.htm
If not, I have used Macro Express to format tables in Rh. No reason it could not be used in Word.
See www.grainge.org for RoboHelp and Authoring tips
@petergrainge -
how to solve the problem when opening program illustrator cs6
ERROR: 16
It is WINDOWS 8.1 / 64 BIT
help pleaseThanks, Jeff! The file Adobe Setup Error.log contains the following information:
02/14/14 07:20:26:474 | [INFO] | | OOBE | DE | | | | 8860 | DEVersion: 5.0.0.0
02/14/14 07:20:26:475 | [INFO] | | OOBE | DE | | | | 8860 | Loading library from C:\Program Files (x86)\Common Files\Adobe\OOBE\PDApp\DECore\DE5\Setup.dll
[ 8860] Fri Feb 14 07:20:26 2014 INFO
::START TIMER:: [Total Timer]
CHECK: Single instance running
CHECK : Credentials
Load Deployment File
CHECK : Another Native OS installer already running
Create Required Folders
Assuming uninstall mode
Lookup for master payload
[ 8860] Fri Feb 14 07:20:26 2014 ERROR
DW040: The product "{893B3B44-0A1E-404B-8FE8-0A74509102A9}" is not installed. Cannot proceed with the uninstall
[ 8860] Fri Feb 14 07:20:26 2014 INFO
:: END TIMER :: [Total Timer] took 6.90443 milliseconds (0.00690443 seconds) DTR = 579.338 KBPS (0.56576 MBPS)
-------------------------------------- Summary --------------------------------------
- 0 fatal error(s), 1 error(s), 0 warning(s)
ERROR: DW040: The product "{893B3B44-0A1E-404B-8FE8-0A74509102A9}" is not installed. Cannot proceed with the uninstall
Please search the above error/warning string(s) to find when the error occurred.
These errors resulted in installer Exit Code mentioned below.
Exit Code: 33 - The product is not installed, cannot uninstall.
Please see specific errors and warnings for troubleshooting. For example, ERROR: DW040 ... -
How to get the path when i select a directory or a file in a JTree
How to get the path when i select a directory or a file in a JTree
import java.lang.*;
import java.io.*;
import javax.swing.*;
import javax.swing.tree.*;
import java.awt.HeadlessException;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import java.util.Iterator;
* @author Frederic FOURGEOT
* @version 1.0
public class JTreeFolder extends JPanel {
protected DefaultMutableTreeNode racine;
JTree tree;
protected JScrollPane scrollpane;
final static int MAX_LEVEL = 1; // niveau max de descente "direct" dans l'arborescence
* Sous-classe FSNode
* @author Frederic FOURGEOT
* @version 1.0
private class FSNode extends DefaultMutableTreeNode {
File file; // contient le fichier li� au noeud
* Constructeur non visible
private FSNode() {
super();
* Constructeur par initialisation
* @param userObject Object
FSNode(Object userObject) {
super(userObject);
* Constructeur par initialisation
* @param userObject Object
* @param newFile File
FSNode(Object userObject, File newFile) {
super(userObject);
file = newFile;
* Definit le fichier lie au noeud
* @param newFile File
public void setFile(File newFile) {
file = newFile;
* Renvoi le fichier lie au noeud
* @return File
public File getFile() {
return file;
public JTree getJTree(){
return tree ;
* Constructeur
* @throws HeadlessException
public JTreeFolder() throws HeadlessException {
File[] drive;
tree = new JTree();
// cr�ation du noeud sup�rieur
racine = new DefaultMutableTreeNode("Poste de travail");
// cr�ation d'un noeud pour chaque lecteur
drive = File.listRoots();
for (int i = 0 ; i < drive.length ; i++) {
FSNode node = new FSNode(drive, drive[i]);
addFolder(drive[i], node); // on descend dans l'arborescence du lecteur jusqu'� MAX_LEVEL
racine.add(node);
// Gestion d'evenement sur JTree (on �coute les evenements TreeExpansion)
tree.addTreeExpansionListener(new TreeExpansionListener() {
public void treeExpanded(TreeExpansionEvent e) {
// lorsqu'un noeud est ouvert
// on descend dans l'arborescence du noeud jusqu'� MAX_LEVEL
TreePath path = e.getPath();
FSNode node = (FSNode)path.getLastPathComponent();
addFolder(node);
((DefaultTreeModel)tree.getModel()).reload(node); // on recharche uniquement le noeud
public void treeCollapsed(TreeExpansionEvent e) {
// lorsqu'un noeud est referm�
//RIEN
// alimentation du JTree
DefaultTreeModel model = new DefaultTreeModel(racine);
tree.setModel(model);
setLayout(null);
// ajout du JTree au formulaire
tree.setBounds(0, 0, 240, 290);
scrollpane = new JScrollPane(tree);
add(scrollpane);
scrollpane.setBounds(0, 0, 240, 290);
* Recuperation des sous-elements d'un repertoire
* @param driveOrDir
* @param node
public void addFolder(File driveOrDir, DefaultMutableTreeNode node) {
setCursor(new Cursor(3)); // WAIT_CURSOR est DEPRECATED
addFolder(driveOrDir, node, 0);
setCursor(new Cursor(0)); // DEFAULT_CURSOR est DEPRECATED
* Recuperation des sous-elements d'un repertoire
* (avec niveau pour r�cursivit� et arr�t sur MAX_LEVEL)
* @param driveOrDir File
* @param node DefaultMutableTreeNode
* @param level int
private void addFolder(File driveOrDir, DefaultMutableTreeNode node, int level) {
File[] fileList;
fileList = driveOrDir.listFiles();
if (fileList != null) {
sortFiles(fileList); // on tri les elements
// on ne cherche pas plus loin que le niveau maximal d�finit
if (level > MAX_LEVEL - 1) {return;}
// pour chaque �l�ment
try {
for (int i = 0; i < fileList.length; i++) {
// en fonction du type d'�l�ment
if (fileList[i].isDirectory()) {
// si c'est un r�pertoire on cr�� un nouveau noeud
FSNode dir = new FSNode(fileList[i].getName(), fileList[i]);
node.add(dir);
// on recherche les �l�ments (r�cursivit�)
addFolder(fileList[i], dir, ++level);
if (fileList[i].isFile()) {
// si c'est un fichier on ajoute l'�l�ment au noeud
node.add(new FSNode(fileList[i].getName(), fileList[i]));
catch (NullPointerException e) {
// rien
* Recuperation des sous-elements d'un noeud
* @param node
public void addFolder(FSNode node) {
setCursor(new Cursor(3)); // WAIT_CURSOR est DEPRECATED
for (int i = 0 ; i < node.getChildCount() ; i++) {
addFolder(((FSNode)node.getChildAt(i)).getFile(), (FSNode)node.getChildAt(i));
setCursor(new Cursor(0)); // DEFAULT_CURSOR est DEPRECATED
* Tri une liste de fichier
* @param listFile
public void sortFiles(File[] listFile) {
triRapide(listFile, 0, listFile.length - 1);
* QuickSort : Partition
* @param listFile
* @param deb
* @param fin
* @return
private int partition(File[] listFile, int deb, int fin) {
int compt = deb;
File pivot = listFile[deb];
int i = deb - 1;
int j = fin + 1;
while (true) {
do {
j--;
} while (listFile[j].getName().compareToIgnoreCase(pivot.getName()) > 0);
do {
i++;
} while (listFile[i].getName().compareToIgnoreCase(pivot.getName()) < 0);
if (i < j) {
echanger(listFile, i, j);
} else {
return j;
* Tri rapide : quick sort
* @param listFile
* @param deb
* @param fin
private void triRapide(File[] listFile, int deb, int fin) {
if (deb < fin) {
int positionPivot = partition(listFile, deb, fin);
triRapide(listFile, deb, positionPivot);
triRapide(listFile, positionPivot + 1, fin);
* QuickSort : echanger
* @param listFile
* @param posa
* @param posb
private void echanger(File[] listFile, int posa, int posb) {
File tmpFile = listFile[posa];
listFile[posa] = listFile[posb];
listFile[posb] = tmpFile; -
How to determine the policy, when it is applied?
Hi!
Perform Group Policy.
When do I need to reboot when
to logoff, and when the policy is executed after
without further action?
How to determine the policy, when it is applied?Hi,
Group policy settings that affect computer settings section apply at reboot and refrresh every 90 min (default refresh interval for computers). Group policy settings that affect user settings section apply at user logon to the domain.
You can use RSOP.MSC or command-line gpresult /? to find out what/which GPO settings have been applied to the computer/user belonging to a domain.
More information can be found below:
http://msdn.microsoft.com/en-us/library/aa373481(v=vs.85).aspx
http://technet.microsoft.com/en-us/library/cc940895.aspx
Hope this help.
Regards,
Calin -
How to validate the field when i am populating the data cursor to block
Hi,
I am populating data cursor to multi record block.
Block contain 5 items. I am populating data cursor to block for 4 items. User will enter one item value that is quantity field.
If user enter negative values and decimal points in quantity filed i need to display message to user item level.
Please do the needful how to do it.902434 wrote:
Hi,
I am populating data cursor to multi record block.
Block contain 5 items. I am populating data cursor to block for 4 items. User will enter one item value that is quantity field.
If user enter negative values and decimal points in quantity filed i need to display message to user item level.
Please do the needful how to do it.If you want to validate at entry level then use When-Validate-Item trigger and check the input and show message. Like
If :quentity <0 then
message('do not enter negative value');
message('do not enter negative value');
raise form_trigger_failure;
end if;Why u open same thread again ? not closing one.. check this one
</a>
How to validate the field when i am populating the data cursor to block
Hopes this helps
If someone's response is helpful or correct, please mark it accordingly. -
How to deselect the text when I start the program?
how to deselect the text when I start the program?
photo:wants the blue background could not be seen:
Code Form:
Public Class Form2
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If ComboBox1.SelectedItem = "The Sims 4" Then
Form3.Show()
Else
End If
If ComboBox1.SelectedItem = "The Sims 3" Then
Form4.Show()
Else
End If
End Sub
End Class
There's a lot wrong with all of that.
I'm sorry that I won't be able to help...
Still lost in code, just at a little higher level. -
How to set the selectedIndex when dataProvider is an XML object in DropDownList?
dataProvider was an XML object
How to set the selectedIndex when dataProvider is an XML object in DropDownList?
I do this:
<s:DropDownList id="dropDownList" requireSelection="true" selectedIndex="2"
labelField="lastName" dataProvider="{employeeService.lastResult.employees.employee}"/>
But always the first item is selected whatever the value of selectedIndex equals to.if i understand correctly, you want the selectedindex to be 2 when the DropDownList displays.
It might be the case that the dataprovider is being sought after it's already selected its index (as the dataprovider isn't already determined to begin with), so currently it's
- setting the selected index to default
- setting the selected index to 2 (your command)
- getting the dataprovider
- setting the selected index to default
try writing a function to set the DropDownList's selected index after it's received the information, or even just attach it to the employeeService result handler.
for quick testing sake you could just add
<s:DropDownList id="dropDownList" requireSelection="true" updateComplete="dropDownList.selectedIndex = 2"
labelField="lastName" dataProvider="{employeeService.lastResult.employees.employee}"/>
to see if my theory is correct. -
How to view the date when the Customers credit limit updated in SAP-FSCM?
How to view the date when the Customers credit limit updated in SAP-FSCM?
OK you can look at field - LIMIT_CHG_DATE in the table - UKMBP_CMS_SGM via SE16
I would assume you would want to run it based on a date range. -
How to aggregate the measue when click '∑' ?
Hi Experts,
How to aggregate the measue when click '∑' ?
For example:
In table view.
A-----------A1-----------2
A-----------A2-----------3
ATotal-------------------5
B-----------B1-----------2
B-----------B2-----------3
BTotal-------------------5
GrTotal------------------10(It is not my expected result.)
However, GrTotal is not my expect result, the correct result is 5 , not 10. How to implement my requrement? Thanks.Hi,
If you want the result to be the average of your sub-totals (?) then I think the only way you can do is is by using a union query to give the 'illusion' of a grand-total.
Using this mechanism you can create a grand-total using whatever logic you wish, you then just combine the result and with cunning use of headings / formatting make it look exactly like a standard functionality total.
Helpful?
regards,
Robert. -
How to get the tab when is it pressed?
I have the following situation:
I have an array of JTextField inside a scroollpane. The size of my array is nine or ten depends on some rules. But my window show just four JTextField. So I would like to know how to get the event when I press "tab", just to show the others JTextField while I'm pressing "tab". Because I need this event to scrooll down or scrooll up.
I tried the keylistener, but when I press "tab" any method(keypressed, keyreleased, keytyped) is called.
I also tried the focuslistener. If this event I could scrooll down or scrooll up, but I couldn't do both!!
Can somebody help me??
Thanks anyway!!
GinJTextField implements Scrollable interface, which provides information to the enclosing container such as JScrollPane.
Hence when the tab event is fired, you can compute the Rectangle area that should be visible and then call the 'scrollRectToVisible()' method in JTextField. This will inform the JScrollPane to scroll to the rectangle that you mention.
HTH -
Can anyone tell me how to remove the owner when setting the location
Hello,
Can anyone tell me how to remove the owner when setting the location?
Properties
Table Name: (Table Name)
Table Type: Tables
Owner: Public
Overridden Qualified Table Name: (Table Name - same as above)
Any help would be appreciated.
Thanks
AnnHi Ann,
please check this document to determine the correct space for your question:
Find Topic Spaces on SCN (Forums)
If you need help moving it, let me know!
Thanks,
Kristen -
How to delete the one of cost centers in Splitting Structure(OKEW)?
Dear All,
I have a question about Splitting Structure as below? Could I get favor from you? Thanks a lot.
How to delete the one of cost centers in Splitting Structure(OKEW)?
JochaHi Chang
Welcome to SDN! Its our pleasure to help you here
Step 1: Select your Cost Center in OKEW which is assigned to the Splitting Str
Eg: Cost Ctr 1001 is assigned to Splitting Str Z1... Tick the Check box against 1001 under Z1 Splitting Str
Step 2: Do a Single Click on the text "Non Assigned Cost Centers"
Step 3: Press Shift +F6 (Or Click on the Assign Button, next to the Pencil icon)
Br, Ajay M
Maybe you are looking for
-
Why inspect element is not working in firebug after updating firefox to 14 version?
firefox upgraded to 14.0.1. After this, I am not able to see element html code in firebug. i.e inspect element is not working as expected.
-
Hi all, how do I save analysis in Excel file into Windows share folder automatically on daily basis? Also my need is to automatically set prompt date in analysis as "sysdate - 1" (yesterday) before saving. Is it possible at all? OBIEE 11.1.1.6.12
-
Adding background image to portlet title bar
Hi, Does anyone know how to add a background image to a portlet title bar. I have tried using the LAF editor but nothing seems to work. The image will be static and not change. Any help appreciated.
-
Installing Solaris Express 11 on a USB stick
Hi, I am in the process of building a resilient development/testing lab server using 4 SATA disks in a RAIDZ configuration, I want to boot the host SE 11 o/s off a internal USB stick to manage this server, so my question is how do I go about installi
-
Error while installing EP6 Sneak Preview
Hi, When I install of SAP Web Application Server Java 6.40 SP3(sapinst.exe),something wrong.... Error Message: ERROR 2004-08-16 07:41:51 CJS-20024 J2EE engine JC00 of SAP system P64 did not come up after 800 seconds: giving up. Could anybody solve t