Adding to a string
hi
is there a function in java that lets you add a certain number of characters to a string like
string.add( number of occureences, character to add)
eg
string = "abc"
string.add(5,'d')
then the string would equal "abcddddd"
is there anyway to do this? i think the command in basic or visual basic is instr or sumthing.
thanks
I can guess strings you want to get are not very long (on longer than 80 or 132 characters depending on). In this case:
final static String filler=" ";
string+=filler.substring(0, 5 /*or whatever, f.i. 10-string.length() */);
will do. If the size is not limited, you can use dynamically growing array of chars and stringBuffer.append(char[] str, int offset, int len)
Similar Messages
-
hi,
seem to be having some trouble adding to a string array of names
im trying to take a name from a text field and add it to the array
help would be much appreciated
this is the string array
String[] AuthorString = {"John Grisham","Agatha Christie","Nick Coleman","Scott Sinclair"};which is loaded into
public void fillArrayList(){
for(int a=0; a<AuthorString.length; a++) {
AuthorList.add((String)AuthorString[a]);
}i then try and add to this using
public void AddMember(){
String temp = (String)AuthorField.getSelectedItem();
for(int a=0; a>AuthorList.size(); a++) {
String temp = (String)AuhtorList.get(a);
AuthorString .addItem(temp);
}can anyone see any problem with this, or am i doing it the completely wrong wayAlso, your "for" loop's test condition is backwards. It should use "less than":
a < AuthorList.size() -
Preventing select-string from adding additional undesired strings in the output file
Hi friends
in PS 4.0 i am trying to write a function which
step1: export the list of all eventlogs ----> wevtutil el > "$home\documents\\loglist1.txt"
step2: deleted the following two lines from loglist1.txt
DebugChannel
Microsoft-RMS-MSIPC
( the reeson of deleting these two lines is wevtutil cl command, can't clear these two evenlogs among approximately 1000 logs)
in fact via select-string with -pattern -notmatch parameters, we select anything except these two line
step3: pastes the select-string contents into the same file ("$home\documents\loglist1.txt") or into new text file (for example
"$home\documents\loglist2.txt")
here is my code:
function MycleareventsAll {
cls
Wevtutil el > "$home\documents\loglist1.txt"
$mycontents = select-string "$home\documents\loglist1.txt" -pattern DebugChannel, Microsoft-RMS-MSIPC -NotMatch
cd "$home\documents\"
$mycontents | out-file loglist2.txt"
# also i tried ---> $mycontents | set-content "loglist2.txt"# also i tried ---> $mycontents | set-content "loglist1.txt"
but the problem is, in addition of deletion, unfortunatelly additional strings (filepath, filename, line number) are added into the final text file so wevtutil will fail clearing logs listed in text file.
here is contents of the final text file
C:\Users\Administrator\documents\loglist.txt:1:Analytic
C:\Users\Administrator\documents\loglist.txt:2:Application
C:\Users\Administrator\documents\loglist.txt:4:DirectShowFilterGraph
but i need the contents be the same as original file without that two specific line:
Analytic
Application
DirectShowFilterGraph
i searched but i didn't find a way to prevent select-string cmdlet from adding these edditional strings
(filepath, filename, line number) into output file while keeping the original contents.
note: -quiet parameter is not what i want. it removes all contents & simply inserts a true or false.
any help?don't forget that Guys here know the basics of security such as clearing event logs & ...
how odd if you don't know this.
clearing all events is useful in test environment for example when i ma teaching my students & need to see all newly created events & work on them
Then you are teching your students how not to use an event log. We use filters and queries to access event logs. We also use event log CmdLets in PowerShell. WEVTUTIL is ok but it does not marry wellwith PowerShell as you have seen.
I have found very few people who are not certified in WIndows administration that know much about eventlogs when it should be a ver important part of administration. PowerShell has mmade EL management much easier but few take the time to learn how
to use the EL support in PowerShell.
I see no point inclearing event logs. It accomplishes nothing.
¯\_(ツ)_/¯
oh your are introducing me filters & queries in event viewer !! please stop Laughing me this way.
your problem is you judge about people's knowledge & you persist on your absurd judgments.
look at your sentence:
"Then you are teaching your students how not to use an event log"
where from you tell this? have you been present in my classes to see what i teach to my students?
have you seen that i told to my students not to use event viewer?
my goal of clearing events is related to myself. it's non of your businesses.
people are not interested to here concurrent irrelevant advises from you like a grandmother. they are searching for a solution. their intent of doing tasks is not up to you. -
I need to getthe int count added to the name of an int rand.
is this possible? rand + count = input.getUserInput("Answer");?
public class jepmain {
* @param args
public static void main(String[] args) {
int i = 0;
String quitornot = "";
getInput input = new getInput();
int count = 0;
jebquestions trivia = new jebquestions();
System.out.println("-----------------------------------------");
System.out.println("Trivia game!");
System.out.println("by ");
System.out.println("-----------------------------------------");
System.out.println("Rules: Put caps where caps are needed, no commas, no dashes, just letters and numbers");
System.out.println("The game keeps going until you get one wrong");
while (i == 0) {
int x = 0;
while (x == 0) {
count++;
int rand = (int) (Math.random() * trivia.questions.length);
System.out.println(trivia.questions[rand]);
String answ = input.getUserInput("Answer");
if (answ.equals(trivia.answers[rand])) {
System.out.println("Correct");
x=0;
else {
System.out.println("wrong");
x--;
//alows the user to play again
quitornot = input.getUserInput("Do you want to play again[yes, no]");
if (quitornot.equals("yes")) {
i = 0;
if (quitornot.equals("no")) {
i++;
System.out.println("Thank you for playing the trivia game");
System.out.println("by ");
System.out.println("Goodbye");
}thankssys5 wrote:
I need to getthe int count added to the name of an int rand.
is this possible? rand + count = input.getUserInput("Answer");?No you don't, trust me. What you need is an array. -
Adding a line (String text) to a file ,only if it is not present in the
Please tell me the java code to add a String line to a file.
The condition is the string to be added should not be present in the file
Thanks in advanceHi ,
The one simple solution is you can read the file in a string.
The check the string you want to insert in the string so formed.
By using
int if((str.indexOf("String to be inserted"))!=-1)
//Insert in the file
else
//dont Insert in the file
Thanks & Regards
Pradeep -
Can you control a URL in eloqua from being adding the query string??
If I am inserting a URL in an email, i cant seem to stop eloqua from adding extra parameters in the form of query string in eloqua.
I want to make this happen because the URL doesnt seem to work if we add any extra parameter using query string.I've tired doing this and it did not work for me. However, I was able to find a solution that helped me a whole lot.
After running all test runs - I found a solution that helped me take off the extra parameters that Eloqua adds to all URL's.
I created my urls without placing "http://" or "https://" or http://www." or "https://www." and that helped take off all tracking.
Re: Use of tinyUrl -
External tools - adding DB Connection string gives error
I'm using SQL Developer 1.2.1.32.13 on Ubuntu 7.10. Whenever I try to add the "DB Connection String ${sqldev.conn} to the argument list of an external tool I get the error listed below. I searched this forum and don't see anything regarding this.
java.lang.NullPointerException
at oracle.dbtools.raptor.macros.ConnMacroExpander.expand(ConnMacroExpander.java:25)
at oracle.ide.externaltools.macro.MacroExpander.getSampleExpansion(MacroExpander.java:134)
at oracle.ideimpl.externaltools.ui.MacroPickerImpl.updateSample(MacroPickerImpl.java:128)
at oracle.ideimpl.externaltools.ui.MacroPickerImpl.updateDetails(MacroPickerImpl.java:173)
at oracle.ideimpl.externaltools.ui.MacroPickerImpl.mav$updateDetails(MacroPickerImpl.java:73)
at oracle.ideimpl.externaltools.ui.MacroPickerImpl$DetailUpdateListener.valueChanged(MacroPickerImpl.java:486)
at javax.swing.JList.fireSelectionValueChanged(JList.java:1765)
at javax.swing.JList$ListSelectionHandler.valueChanged(JList.java:1779)
at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:167)
at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:147)
at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:194)
at javax.swing.DefaultListSelectionModel.changeSelection(DefaultListSelectionModel.java:388)
at javax.swing.DefaultListSelectionModel.changeSelection(DefaultListSelectionModel.java:398)
at javax.swing.DefaultListSelectionModel.setSelectionInterval(DefaultListSelectionModel.java:442)
at javax.swing.JList.setSelectionInterval(JList.java:2035)
at javax.swing.plaf.basic.BasicListUI$Handler.adjustSelection(BasicListUI.java:2721)
at javax.swing.plaf.basic.BasicListUI$Handler.mousePressed(BasicListUI.java:2677)
at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:263)
at java.awt.Component.processMouseEvent(Component.java:6035)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
at java.awt.Component.processEvent(Component.java:5803)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3983)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:177)
at java.awt.Dialog$1.run(Dialog.java:1039)
at java.awt.Dialog$3.run(Dialog.java:1091)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Dialog.show(Dialog.java:1089)
at java.awt.Component.show(Component.java:1419)
at java.awt.Component.setVisible(Component.java:1372)
at java.awt.Window.setVisible(Window.java:801)
at java.awt.Dialog.setVisible(Dialog.java:979)
at oracle.bali.ewt.dialog.JEWTDialog.runDialog(Unknown Source)
at oracle.bali.ewt.dialog.JEWTDialog.runDialog(Unknown Source)
at oracle.ideimpl.externaltools.ui.MacroPickerImpl.runDialog(MacroPickerImpl.java:283)
at oracle.ideimpl.externaltools.program.ExternalProgramOptions.runMacroPicker(ExternalProgramOptions.java:429)
at oracle.ideimpl.externaltools.program.ExternalProgramOptions.doBrowseArguments(ExternalProgramOptions.java:417)
at oracle.ideimpl.externaltools.program.ExternalProgramOptions.mav$doBrowseArguments(ExternalProgramOptions.java:57)
at oracle.ideimpl.externaltools.program.ExternalProgramOptions$ActionDispatcher.actionPerformed(ExternalProgramOptions.java:492)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6038)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
at java.awt.Component.processEvent(Component.java:5803)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:177)
at java.awt.Dialog$1.run(Dialog.java:1039)
at java.awt.Dialog$3.run(Dialog.java:1091)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Dialog.show(Dialog.java:1089)
at java.awt.Component.show(Component.java:1419)
at java.awt.Component.setVisible(Component.java:1372)
at java.awt.Window.setVisible(Window.java:801)
at java.awt.Dialog.setVisible(Dialog.java:979)
at oracle.bali.ewt.wizard.WizardDialog.runDialog(Unknown Source)
at oracle.bali.ewt.wizard.WizardDialog.runDialog(Unknown Source)
at oracle.ideimpl.externaltools.ui.ExternalToolsWizard.runEditWizard(ExternalToolsWizard.java:230)
at oracle.ideimpl.externaltools.ui.ToolListPanel.doEditCommand(ToolListPanel.java:614)
at oracle.ideimpl.externaltools.ui.ToolListPanel.mav$doEditCommand(ToolListPanel.java:80)
at oracle.ideimpl.externaltools.ui.ToolListPanel$ButtonListener.actionPerformed(ToolListPanel.java:736)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6038)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
at java.awt.Component.processEvent(Component.java:5803)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:177)
at java.awt.Dialog$1.run(Dialog.java:1039)
at java.awt.Dialog$3.run(Dialog.java:1091)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Dialog.show(Dialog.java:1089)
at java.awt.Component.show(Component.java:1419)
at java.awt.Component.setVisible(Component.java:1372)
at java.awt.Window.setVisible(Window.java:801)
at java.awt.Dialog.setVisible(Dialog.java:979)
at oracle.bali.ewt.dialog.JEWTDialog.runDialog(Unknown Source)
at oracle.bali.ewt.dialog.JEWTDialog.runDialog(Unknown Source)
at oracle.ideimpl.externaltools.ui.ToolListPanel.runDialog(ToolListPanel.java:283)
at oracle.ideimpl.externaltools.ExternalToolsController.handleEvent(ExternalToolsController.java:18)
at oracle.ideimpl.controller.IdeActionHook$MetaClassController.handleEvent(IdeActionHook.java:272)
at oracle.ide.controller.IdeAction.performAction(IdeAction.java:551)
at oracle.ide.controller.IdeAction$2.run(IdeAction.java:804)
at oracle.ide.controller.IdeAction.actionPerformedImpl(IdeAction.java:823)
at oracle.ide.controller.IdeAction.actionPerformed(IdeAction.java:521)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1216)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1257)
at java.awt.Component.processMouseEvent(Component.java:6038)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
at java.awt.Component.processEvent(Component.java:5803)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)Since posting, I have moved to 1.5 but still have problems. Also, I am using Linux not Windows. For testing purposes I set up an external tool called "echo" with the following configuration:
Program executable: /bin/echo
Arguments: TERM:${env:var=TERM} sqldev.conn:${sqldev.conn} sqldev.dbuser:${sqldev.dbuser}
Run Directory: /bin
I have added the tool to "Tools Menu", "Navigator Context Menu" and "Code Editor Context Menu"
Enabled is set to "Always"
If I highlight the a connection and then right click, and select "echo" the following is displayed in the log:
/bin>
/bin/echo TERM: sqldev.conn: sqldev.dbuser:
TERM: sqldev.conn: sqldev.dbuser:
In order to get any of the values populated I have to expand not only the connection so that all the items (Tables, Views, Indexes, etc) are displayed but also one of these sub items as well. If I expand tables and then right click on any given table I will finally get some output from my echo command:
/bin>
/bin/echo TERM: sqldev.conn:jdbc:oracle:thin:@db.server.domain:1526:prod sqldev.dbuser:
TERM: sqldev.conn:jdbc:oracle:thin:@db.server.doamin:1526:prod sqldev.dbuser:
It seems to me that if I want to run SQL*PLus I should just highlight the connection name and it should use that information in whatever external tool I have configured. -
Adding a JSON string to an outbound RESTful call in OSB 11.1.1.6
Inside my Proxy Service Message Flow (OSB 11.1.1.6) I have generated a JSON string and stored it in a variable named $jsonReq.
In my Routing action, I point to a Business Service whose Service Type is "Messaging Service" with both Request/Response Message Types as "Text".
What is the proper way to assign the $jsonReq variable's contents to the outbound request body (I am doing a POST)?
I have tried a number of configurations, but to no avail (though I see the JSON contents when I dump it out in a Log action), such as:
Insert
Expression: $jsonReq
Location: as first child of
XPath: .
In Variable: outbound
Please advise.
Thank you,
MichaelHello Prabu,
Thank you for the suggestion. Assigning it to the body didn't work. I changed my configuration to this:
Insert
Expression: $jsonReq
Location: as first child of
XPath: .
In Variable: outbound
The net effect that I can see via the Test Console invocation tracing is that the change from:
RouteToMyBusinessService -> Message Context Changes -> changed $body
<soap:Body xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<!-- our original body from the proxy service inbound SOAP message -->
</soap:Body>
to
RouteToMyBusinessService -> Message Context Changes -> changed $body
<soap:Body xmlns:soap="http://www.w3.org/2003/05/soap-envelope"/>
I know that the $jsonReq has data in it (per a log statement I made: <Jun 6, 2013 7:55:40 AM CDT> <Debug> <ALSB Logging> <BEA-000000> < [RouteToSCCreateBAMLabsProfileBusSvc, null, null, REQUEST] Inserted {"firstName":"string","lastName":"s","email":"stringstring","Login":"string","timeZone":"America/Montevideo","address":{"streetOne":"string","streetTwo":"string","city":"string","state":"st","zipCode":"string","country":"string"},"equipment":{"e":{"type":"Bed","code":"string","serial":"string","sku":"string","version":"string","dateOfPurchase":"2013-11-23T08:44:07"}}} into body> ).
So why would the body be empty when I use the Insert action listed above?
On a side note, is there only one 'body' variable in a proxy message flow? How do I distinguish between the body of the incoming request, the body of the [transformed] outgoing business service request, the body of the business service response and the body of the [transformed] proxy service response?
Thanks again,
Michael -
Custom List Template - Adding a substitution string
Hi all,
I have created a List template by copying an existing list template.
I want to have a substitution string so that I can assign a different identification to the list itself each time I use the list template.
<ul id="#SOME_SUBSTITUTION_STRING#">
<li></li>
<li></li>
</ul>The #A01# - #A10# seems to be applied only on list items. I cannot find a way to have such a substitution string that can be applied to the unordered list tag.
Would anyone know of a way to do that? I'm using Apex 3.1
Thanks,
RaihaanThe reason I want to be able to specify the id of the unordered list is that I have a javascript function using the id to build the rest of the list dynamically.
But if that's not possible, I will have to hardcode the "id" in the template and have a different template everytime I want to implement a list having the same characteristics.
Thanks,
Raihaan -
How to add a image between two string.
example
Test string one <IMG> testing string twoAn empty loop to wait for something is to avoid in all languages! At worst, put a sleep call in the loop. But a better idiom for JavaFX would be:
function ChangeImage(image: Image): Void
fadeOut.action = function()
selectedImage = Image
url: fileURL;
height: 400, preserveRatio: true
backgroundLoading: true
var progress = bind selectedImage.progress on replace
if (progress == 100)
fadeIn.playFromStart();
fadeOut.playFromStart();
}(untested)
First, I create the Image when needed, to start the background loading. Or maybe the loading is very long and you prefer to start earlier, so your version is fine in this case.
Second, I do what I described, binding to the progress variable of selectedImage, and watching the updates. And when we reach the wanted value, we start the second animation. -
Trouble adding commas to string
I'm using a pretty standard function to add commas to a large
number (so that a number like 1000000 appears as 1,000,000). Below
is the actionscript I'm using.
When I define the variable debt as any number, the script
works perfectly. But if I define debt as a variable passed to the
movie from a PHP file, then the script puts the commas in the wrong
places (i.e., 10,000,00). Can anyone explain to me why this would
happen, and how to fix it?
var input = debt;
var inputString = input.toString();
var finalString = "$";
var count = 0;
var tempString = "";
for (var i = inputString.length-1; i>=0; i--) {
count++;
tempString += inputString.charAt(i);
if ((count%3 == 0) && (i - 1 >= 0)) {
tempString += ",";
for (var k = tempString.length; k>=0; k--) {
finalString += tempString.charAt(k);
return(finalString);I can see that this is cleaner than my script. However, the
comma problem continues...
quote:
Originally posted by:
LuigiL
Nope, coming from PHP your var is already a string. Omit the
toString()
var input = "1000000";
//var inputString = input.toString();
var finalString = "$";
var count = 0;
var tempString = "";
for (var i = input.length-1; i>=0; i--) {
count++;
tempString += input.charAt(i);
if ((count%3 == 0) && (i - 1 >= 0)) {
tempString += ",";
for (var k = tempString.length; k>=0; k--) {
finalString += tempString.charAt(k);
trace(finalString); -
Adding a Entrypoint String in NI_ParallelModel Data (Teststand 4.2)
Hi,
I am converting a 2012 Parallel model sequence into a Teststand 4.2 Parallel Model.
First issue I saw is the insert field in the Parameters('Pre UUT').Modeldata, is greyed out. Basically I would like to add the string "EntryPoint".
The Parameters('Pre UUT').Modeldata is passed by reference, type is NI_ParallelModelData which is similar to 2012 parallel model.
Any ideas?
Thanks!
DonHi Daniel,
I am downgrading existing 2012 Test exec with custom interface to 2009 equivalent version.
The custom interface in 2012 needs the Entrypoint field in the parameters.modeldata (type NI_ParallelModelData2)
In 2012, the custom interface is called at DoPreUUT, but in 2009, it does not use DoPreUUT, but I can give a try to mimic it.
Then in the parameters.modeldata it does not have entrypoint field.
Where is the menu for the migrating from 2012 process model to 2009 process model?
Thanks! -
Adding diffrent colored strings to a JTextArea
I writing a program that uses a messaging window like AIM, GAIM, Trilian etc that uses two JTextarea's to write and read the text. Thus far I cannot figure out how to add strings of diffrent colors to the JTextarea used for writing. The tutorials only explain how to set the font and color of typed text, not text i want to take form the write pane and add it to the read pane. Any ideas?
You might start with this:
http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html
in the Java Tutorial
and possibly this:
http://javaalmanac.com/egs/javax.swing.text/pkg.html -
is there a way to put integers in strings?
like in the following script putting the string values in characters is there a way to put in numbers instead?
class Sid {
public static void main(String[] arguments) {
String heads = "tweleve";
String noses = "thirteen";
String organs = "zero";
String guess = "twenty-five";
System.out.println("you have " + heads + " heads and " + noses + " noses");
System.out.println("The computer guesses you have " + guess + " limbs");
organs = "twenty-five";
System.out.println("Answer: \n\t" + organs.equals(guess));
System.out.println("in total you have:\n\t twenty-five limbs!");
System.out.println("hmm.. how many characters are there in twenty-five?");
int length = organs.length();
System.out.println("there are " + length + " charachters in " + organs);
}Since everything is hard-coded anyway, just hardcode numbers.
You might want to think about storing all numbers in numeric-typed variables (like, ints) and then, if you really need numbers spelled out textually, pass them through a utility method to translate numbers to text descriptions of numbers immediately prior to output. -
Hi im trying to write a method that will display a set of '*' i know this is a common question but im having trouble doing it with line.separator.
my problem is why can you not add to a string to increase it in a loop so you get
my code gets
why does star = star + "*" not add to star on the next. it still displays one * im completely lost here any help would be appreshated
public String toString()
String stars = "";
for(int count = 0; count < this.size; count++)
stars = stars + "*" + System.getProperty("line.separator");
return stars ;
}i've figgered how to do it with just displaying the * but i still can see how to save the * triangle to a string variable to be return when the user calls this method
public static void test()
for (int count = 1; count<= getSize; count++)
for (int star = 1; star <= count; star++)
System.out.print ("*");
System.out.println();
}
Maybe you are looking for
-
Quality Certificate Report for Vendor
Dear Sir, I need a help from your end. I need a program or logic, where I can put the vendor ID, and get all the Quality certificate details of that particular vendor. Thanks & Regards, Kuntal
-
Premiere Elements project imported into Premiere Pro CS5.5 becomes unusable after first save
I have Premiere Pro CS5.5, and I have been trying for some time to successfuly edit an old project that was originally created in Premiere Elements (not sure which version--probably 7.0). It has the .prel extension. The project imports just fine, and
-
Does anyone know how to protect a pdf portfolio from being locally saved or from extracting files/pages. These are documents that are not uploaded to internet however are shared with a number of people who should only be able to open and view docume
-
How do I get canon dpp to see files which are sitting in iPhoto?
I have imported files from Canon 5dmkii into iphoto and there are 150 of them in two folders, raw files, loaded Canon DPP raw editor and it does not see the files in iphoto. Is there something I am neglecting to do, I just bought this rMBP two days
-
I ordered a ringtone that came as a song and did not appear in a position status to be added. It did not show up but came purchased as a song and now asking me to add it to a playlist. This is not what I wanted to do and I promptly follow the promp