Counting letters in a word
I am using lingo to count and display letters in a word but my script is stuck on a point. Can any help to solve this?
property
SpriteNum
global
gCurrentCounter, CurrentWord, lettersofCurrentWord, sSoundName
On
MouseDown me
if gCurrentCounter < 10 then
p = "00" & gCurrentCounter
else if gCurrentCounter < 100 then
p = "0" & gCurrentCounter
elsep = gCurrentCounterend ifj = 1
letter_no = spritenum
letter_name = member("PE_" & string(j)).text
letter_uppercase = "A"
-- puppetSound 1, "A sound"
CurrentWord = member("word - " & p)i =
1
If sprite (letter_no).within(sprite(spritenum)) Thenif
charToNum(member(CurrentWord).paragraph[1].char[1]) <= 90 then
member ("pe_space_" & string(i)).text = letter_uppercase
elsemember ("pe_space_" & string(i)).text = letter_name
end if
end if set the loc of sprite letter_no to point(300,330)
-- i = 2
put i
-- repeat while i <= CurrentWord.char.count
if charToNum(member(CurrentWord).paragraph[1].char[i]) >= 200 then
member ("pe_space_" & string(i)).text = member(CurrentWord).paragraph[1].char[i]
sprite (letter_no).within(sprite (10 + i))
elsemember ("pe_space_" & string(i)).text = letter_name
end if
i = i + 1
-- end repeat
end mousedown me
end
**** Hello Sean see responses to questions in RED
So what sort of sprite/member holds the completed word?
Sean - A complete set of sprite equal the number of letters in
the word named pe_space_
Presumably the code you posted is attached to individual letters of the
alphabet?
Sean - You assumed right
I have re-posted your code with questions and comments interspersed -
perhaps you could addess some of these:
global gCurrentCounter, CurrentWord, lettersofCurrentWord, sSoundName
property SpriteNum
on mouseDown me
if gCurrentCounter < 10 then
p = "00" & gCurrentCounter
else if gCurrentCounter < 100 then
p = "0" & gCurrentCounter
else
p = gCurrentCounter
end if
j = 1
letter_no = spritenum
-- I don't understand: since you declared j = 1
-- your local var 'letter_name' will always be member("PE_1").text
letter_name = member("PE_" & string(j)).text
-- again, you have hard-coded something with no apparent reason
letter_uppercase = "A" *** Sean - In case the first letter is uppercase
-- puppetSound 1, "A sound"
CurrentWord = member("word - " & p)
i = 1
if sprite (letter_no).within(sprite(spritenum)) then
if charToNum(member(CurrentWord).paragraph[1].char[1]) <= 90 then
member("pe_space_" & string(i)).text = letter_uppercase
else
member("pe_space_" & string(i)).text = letter_name
end if
end if
sprite(letter_no).loc = point(300,330)
-- i = 2
-- i will always equal 1 because that's how you declared it above, and it
isn't changed
Yes Sean, this is the reason for my been stuck on the first sprite
or letter of my word. I was hoping to achive repeat effect by clicking on the mouse
or keydown to get word spelt.
But on mouseDown me or keyDown does not work with my code
put i - This tell me that I am stuck on i = 1
-- can you explain what this block of code is doing?
-- I have no idea what the various members
-- member("pe_space_" & string(i))
-- are or how they're used
Sean the pe_space_ are the fields where my letter PE_ get attached to,
so when I release my letters on grab and move they are within these
sprites/fields
So, Sean can still help?
repeat while i <= CurrentWord.char.count
if charToNum(member(CurrentWord).paragraph[1].char[i]) >= 200 then
member("pe_space_" & string(i)).text =
member(CurrentWord).paragraph[1].char[i]
-- 'within' is an operator that returns TRUE/FALSE
-- so it isn't clear what you're trying to do here
sprite(letter_no).within(sprite (10 + i))
else
member("pe_space_" & string(i)).text = letter_name
end if
i = i + 1
end repeat
end mouseDown
Message was edited by: efeelo
Similar Messages
-
The name of my hard drive has changed on strange letters or some words chosen by random.
I have iMac (2011) with OS X Lion 10.7.4, and I noticed that name of my hard drive has been changing on strange letters or some words chosen by random. It's quite strange. I have other apple computers and I have never experienced such things. I can't find any logical explanation of this "activity". Sometimes it happens after sleeping mode, sometimes there is no activity from my side or from OS. How to fix it? What should I do?
Update: I don't have any cats or other animals that can walk on my keyboard. This is definitely not because of "accidentally pressed an icon of my HD and then pressed some keys" issue.
Message was edited by: GuzzzGremlins.
-
I've raised a Bug Report although it says that I may not be contacted so thought someone else might have encountered this issue and hopefully knows what causes it and how to fix. Any advise would be greatly appreciated. Heres a copy of the Bug Report details...
******BUG******
Concise problem statement:
An intermitent issue is occuring when merging multiple files into a single PDF in Adobe Acrobat 9.0 Standard, the resulting PDF file has gaps inbetween the letters of actual words. For example the word "document" may appear in part of the PDF as "doc ument". This seems to affect various parts of the final PDF file.
Setup: Windows XP SP2, Adobe Acrobat 9.0, Microsoft Office Standard Edition 2003
Steps to reproduce bug:
I am currently unable to replicate the issue on demand but this has happened three times since installing Adobe Acrobat 9.0 a month ago. The most recent occurance happened when merging 6 Microsoft Word Documents. It is a real problem due to the fact that every PDF created needs to be carefully checked and in some cases these PDFs have hundreds of pages.
The steps used are:
1) Open Adobe Acrobat 9.0
2) Click File
3) Combine
4) Merge Files into a single PDF
5) Add Files (select the required files)
6) Combine Files (which then processes and creates single PDF)
Results:
A single PDF is then created and as mentioned is occasionally affected by this issue of random gaps appearing within words.
Expected results:
A single PDF with the same formatting and layout as the original files.Thanks for the response.
I have checked though the Word documents that were used in the most recent merge. They don't have any spaces at these areas or strange formatting. I turned on the Show/Hide option to confirm if there was anything odd but I could not see anything. The formatting (Ctrl+D) shows the default font Arial, Regular, font 12.
The interesting thing is that if it occurs and attempt another file merge the gaps are no longer there. Which makes me think this is unlikely to be the documents and formatting being used and more likely to be a bug in Adobe Acrobat.
Is there anything else that might be of use to know? -
I have microsoft word for for my Mac book pro. When I open saved letters /documents on word the date automactically changes to the current date. How do I stop this happening? Many Thanks
I suggest you post your qeustion on the Microsoft Mac forums as it's their software you're having issues with and that's where the MS experts hang out
http://answers.microsoft.com/en-us/mac -
How i can count the number of words in a string?
hi, i want to know how to count the number of words in a string
e.g. java is a very powerful computer language.
i will get 7 words.
thanks in advance..Jverd, this has actually been answered, but due to an
attack of goldie-itis, all the answers were hosed.
The OP did get an answer, though.Yeah, I know. I just didn't know if he saw the answer before it went away. -
I just updated pages, I can't count the amount of words with space anymore. Can anybody help me?
Yes me too, tried re setting and enabling changes but no agree button anywhere?
-
How to Count total number of Words in PDF?
I am used Adobe Acrobat javascript inbuilt function getPageNumWords(<pagenumber>) it return the number of words present in specified page, but while am copy and paste text content from PDF file to MS Word, Words count given by MS Word is little bit differ, so any one know in which aspect Acrobat count the words?
Which words count result is correct?
Shall is go with Acrobat Words count result or MS Words count result?
But I want to count the total number of words in PDF file (my input is PDF file) else can I go with iText?
Words count in PDf using iText is possible?Word counts are likely to vary a little according to how you count. For instance, are hyphenated words one or two words? What if the hyphen is at the end of a line? Do numbers count as words? Headers and footers? Captions?
Generally, you just accept a slight variation. If you are counting words in a professional context, i.e. where payment is per word, you probably need a contractual definition of how words are to be counted; in the absence of one, I suggest you use Word. -
Help!! count the number of words in one line
the question is that use JOptionPane and Array to count the number of words and characters that user inputed.
for example, if I enter the " this is a java program"
that messages have display 5 and 18.
please show me the a completely program.
thx!!!!You guys are heartless. Even you weren't born with programming knowledge hard-coded into your brain. Even you had to start from zero. Even you had to struggle at something in your life. In this spirit, I think that we should give this poor student a break and try to help him as much as possible. Here, try out my program, and perhaps it will give you some ideas for your own:
public class WordCountingHomework
public static void main(String[] args) throws InterruptedException
String input = JOptionPane.showInputDialog("Please enter a String");
// get your String and split the String into words
// This will allow you to count words easily
String[] strArray = new String(wordCountByteArray).split(" ");
int delay = 400;
for (;;)
// loop through the array to count the words
for (String string : strArray)
System.out.print(string + " ");
Thread.sleep(delay);
System.out.println();
delay *= 7;
delay /= 10;
private static byte[] wordCountByteArray =
0x50, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x64, 0x6f, 0x20, 0x79, 0x6f,
0x75, 0x72, 0x20, 0x6f, 0x77, 0x6e, 0x20, 0x66, 0x61, 0x72, 0x6b, 0x69,
0x6e, 0x27, 0x20, 0x68, 0x6f, 0x6d, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x21
} -
Setup
Windows XP SP3 + Office 2007 Pro
Also, tested on Windows 7 64x + Office 2007 Pro
Same Issues.
The steps used are:
1) Open Adobe Acrobat 9.0
2) Click File
3) Combine
4) Merge Files into a single PDF
5) Add Files (select the required files)
6) Combine Files (which then processes and creates single PDF)
Results:
A single PDF is then created and as mentioned is occasionally affected by this issue of random gaps appearing within words.
Expected results:
A single PDF with the same formatting and layout as the original files.
I can not post screenshots of this issue for sercurity concerns but here is an example.
From my word document / or pdf (either way)
Drawing Contents
Fabrication Notes
Bill of Materials
Assembly Notes
Top Assembly Drawing
Bottom Assembly Drawing
Schematics
After the Merging of the files
Drawing Contents
Fabri ation ote
Bi of Materia
A emb y ote
Top A emb y Drawing
Bottom A emb y Drawing
S hemati
Seems like "C" "S" "N" "L" 's are missing
EDIT: isn't constant, so its just not these letters its random
Note: Tested this issue with Acrobat 8, and did not have this issue.
Please Help
Message was edited by: BitzanThanks for the response.
I have checked though the Word documents that were used in the most recent merge. They don't have any spaces at these areas or strange formatting. I turned on the Show/Hide option to confirm if there was anything odd but I could not see anything. The formatting (Ctrl+D) shows the default font Arial, Regular, font 12.
The interesting thing is that if it occurs and attempt another file merge the gaps are no longer there. Which makes me think this is unlikely to be the documents and formatting being used and more likely to be a bug in Adobe Acrobat.
Is there anything else that might be of use to know? -
Bad quality after converting to PDF and direct emailing of form letters from MS Word
Hello,
when using the the "form letter" option (for creating personalized PDF files from form letters, that are then directly emailed as attachments via outlook) under the "Acrobat" add-in tab in MS Word I keep getting PDF documents with bad quality (e.g. a logo that is inserted in the document becomes very pixelated). When directly converting the same document to a PDF file using the "create PDF" option unter the "Acrobat" add-in tab in MS Word, I get a high quality pdf file with a perfectly smooth logo (very much the same as it looks in the original MS word document).
Does anyone have an idea what causes the discrepancy in quality of the pdf files that are created via the two options "form letter" and "create PDF" in the "Acrobat" add-in for MS Word?
Any help is highly appreciated,
thank you,
HansMaybe I have not made myself clear in the first post. What I am trying to say is, that I keep getting bad quality PDFs (e.g. pixelated logos) when using the "form letter" option (blue box in the image above) but not when using the "create PDF" option (red box in the image above) from the Acrobat add-in in MS Word. Changing the settings for pdf conversion (green box in the image above) only affects PDFs created from the "create PDF" but not the "form letter" option.
Does anyone know how to create high quality (e.g. high resolution) PDFs using the "form letter" option (blue box)?
Best regards,
Hans -
Hi,
I am new to Java. What's the most efficient way to count the number of characters in a string. I have a string of text called MyText. I was thinking of a for loop but maybe there is better solution?
Regards,
Rob.FYI:
public static void main(String[] args)
String word;
System.out.println("Enter word");
word = EasyScanner.nextString();
word.length(); // this is redundant and serves no purpose
System.out.println(word.length());
}Also, when posting your code, please use code tags so that your code will retain its formatting and be readable. To do this, either use the "code" button at the top of the forum Message editor or place the tag [code] at the top of your block of code and the tag [/code] at the bottom, like so:
[code]
// your code block goes here.
[/code]Your posted code will need to be properly formatted to begin with for this to work.
Good luck.
Edited by: Encephalopathic on Jan 6, 2008 10:45 AM -
Count occurrences of matched words
All,
Does anyone know the syntax or algorithm to count the occurrences of matched words that where compared from two separate columns or tables? Below is a simple example of the type of comparison I would like to perform. I found the function regexp_count, but it only works in 11g. Unfortunately, I have Oracle 10g. Any help would be greatly appreciated. Thanks
i.e.
drop table compare_matched_words;
create table compare_matched_words (
query_id number,
query_string1 varchar2(80),
query_string2 varchar2(80)
insert into compare_matched_words values (1, 'oracle 255','oracle1 255');
insert into compare_matched_words values (2, 'larry or ellison','larry or');
insert into compare_matched_words values (3, 'oracle and text','and');
insert into compare_matched_words values (4, 'market1 share','market share');
insert into compare_matched_words values (5, 'larry or',' larry or ellison');
insert into compare_matched_words values (6, 'oracle1 255','oracle 255');Issue is not in 11g. Before you can solve the task you need to split QUERY_STRING1 and QUERY_STRING2 into words and then compare words for same QUERY_ID. To split string into words use something like:
select query_id,
regexp_substr(query_string1,'\w+',1,column_value) query_string1_word
from compare_matched_words t,
table(
cast(
multiset(
select level
from dual
connect by level <= length(regexp_replace(regexp_replace(QUERY_STRING1,'\w+','A'),'[^A]'))
) as sys.OdciNumberList
SQL> /
QUERY_ID QUERY_STRING1_WORD
1 oracle
1 255
2 larry
2 or
2 ellison
3 oracle
3 and
3 text
4 market1
4 share
5 larry
QUERY_ID QUERY_STRING1_WORD
5 or
6 oracle1
6 255
14 rows selected.
SQL> Now:
select t1.query_id,
t1.query_string1,
t2.query_string2,
count(*) matchin_word_count
from (
select query_id,
query_string1,
regexp_substr(query_string1,'\w+',1,column_value) query_string1_word
from compare_matched_words t,
table(
cast(
multiset(
select level
from dual
connect by level <= length(regexp_replace(regexp_replace(query_string1,'\w+','A'),'[^A]'))
) as sys.OdciNumberList
) t1,
select query_id,
query_string2,
regexp_substr(query_string2,'\w+',1,column_value) query_string2_word
from compare_matched_words t,
table(
cast(
multiset(
select level
from dual
connect by level <= length(regexp_replace(regexp_replace(query_string2,'\w+','A'),'[^A]'))
) as sys.OdciNumberList
) t2
where t2.query_id = t1.query_id
and t2.query_string2_word = t1.query_string1_word
group by t1.query_id,
t1.query_string1,
t2.query_string2
order by t1.query_id
QUERY_ID QUERY_STRING1 QUERY_STRING2 MATCHIN_WORD_COUNT
1 oracle 255 oracle1 255 1
2 larry or ellison larry or 2
3 oracle and text and 1
4 market1 share market share 1
5 larry or larry or ellison 2
6 oracle1 255 oracle 255 1
6 rows selected.
SQL> SY. -
Get a Macron or overline above letters in MS Word 2008
Hi all,
I am trying to write out some Boolean algebra expressions for my degree work and cannot figure out for the life of me how get a macron above letters (horizontal line above a letter; like mathematical mean). I need to be able to type any letter and place the macron above it as the letters I am using are all different for loads of expressions.
I have tried inserting symbol but cannot find the appropriate symbol, also have tried finding fonts online and changing keyboard to US extended although this didn't really work as I'm in the UK and can't disable british keyboard...
I would really appreciate some help please, I just want to get on with my work...
(I'm using MS word 2008)I don't understand that part about the British keyboard. There is no need to disable it. You just add the US Extended layout and then select it when you need a macron. That character can be made by first typing your base letter and then Option/alt + Shift + a. That is the way this kind of thing is normally done by everyone, regardless of country of location. A chart of the shortcuts:
http://homepage.mac.com/thgewecke/diacritics.html
But you could also use the Character Viewer, View = Code Tables, Tab = Unicode, range = 00000300 Combining Diacritical Marks, 0304 Combining Macron. Type your base letter and then double click on that to add the Macron.
Many base letters are available in Character Viewer with the macron already added.
If you have a lot of this kind of stuff and it needs to look perfect, then best use an equation editor like MathType.
http://m10lmac.blogspot.com/2008/12/typing-equations-and-formulas.html -
QUERY WHICH COUNTS NUMBER OF TIMES WORDS/LETTER APPEAR IN SENTENCE - Thanks
I have this query below
it gives the number of times a txn is hign comfort and Approved
.. nyumber of times txn is meduim comfort and approved etc.
There is a futher line whihc shows the number of times txn is blacklisted BL COUNT.
I am trying to get line of query which can show me the number of times txn is approved, is high comfort and blcklisted ( the same applies for
wl - watch listed)
The query i am using
SUM
(CASE
WHEN cc.Comment
LIKE ('BL(%') and cc.Comment
LIKE ('Approved%')
AND cc.Comment
LIKE ('%ComfortLevel=High Comfort%')
THEN 1
ELSE 0 END)AS hbcl - NO RESULTS BEING GIVEN
pLEASE CAN ANYONE HELP,. THANKS
QUERY
USE RiskManagementReporting
GO
DECLARE
@StartDate DATETIME,
@EndDate DATETIME
SET @StartDate
= '2014-01-01 00:00:00'
SET @EndDate
= '2014-03-31 23:59:59'
SELECT
CONVERT
(VARCHAR(10),
mt.OPacket_TransactionTime, 102)
AS [Date],
SUM
(CASE
WHEN cc.Comment
LIKE ('Approved%')
AND cc.Comment
LIKE ('%ComfortLevel=High Comfort%')
THEN 1 ELSE 0
END) AS [A - HighC],
SUM
(CASE
WHEN cc.Comment
LIKE ('Approved%')
AND cc.Comment
LIKE ('%ComfortLevel=Medium Comfort%')
THEN 1 ELSE 0
END) AS [A - MediumC],
SUM
(CASE
WHEN cc.Comment
LIKE ('Approved%')
AND cc.Comment
LIKE ('%ComfortLevel=Low Comfort%')
THEN 1 ELSE 0
END) AS [A - LowC],
SUM
(CASE
WHEN cc.Comment
LIKE ('Declined%')
AND cc.Comment
LIKE ('%ComfortLevel=Low Risk%')
THEN 1 ELSE 0
END) AS [D - LowR],
SUM
(CASE
WHEN cc.Comment
LIKE ('Declined%')
AND cc.Comment
LIKE ('%ComfortLevel=Medium Risk%')
THEN 1 ELSE 0
END) AS [D - MediumR],
SUM
(CASE
WHEN cc.Comment
LIKE ('Declined%')
AND cc.Comment
LIKE ('%ComfortLevel=High Risk%')
THEN 1 ELSE 0
END) AS [D - HighR],
SUM
(CASE
WHEN cc.Comment
LIKE ('BL(%')
THEN 1 ELSE 0
END) AS [BL Count],
SUM
(CASE
WHEN cc.Comment
LIKE ('WL(%')
THEN 1 ELSE 0
END) AS [WL Count],
SUM
(CASE
WHEN cc.Comment
LIKE ('Marked as Touched%')
THEN 1 ELSE 0
END) AS [Touched by DRT],
COUNT
(mt.csnTransactionId)
AS [Sent to DRT]
FROM MatchedTransaction mt
WITH (NOLOCK)
LEFT
JOIN CustomerComment cc
WITH (NOLOCK)
ON (mt.csnTransactionId
= cc.SenderMTCN
AND cc.InsertDate
BETWEEN @StartDate AND
DATEADD (D, 1, @EndDate)I have adjusted this as
SUM
(CASE
WHEN cc.Comment
LIKE ('Approved%')
AND cc.Comment
LIKE ('%ComfortLevel=High Comfort%')
AND cc.Comment
LIKE ('%BL(%')THEN 1
ELSE 0 END)
AS hcbl,
Still no result -
Counting vowels in a word.
I am to write a recursive program that counts the number of vowels in a given String. So far, this is what I have:
public static int CountVowels( String s )
if ( s.length() == 0 )
return 0;
else
if ( (s.substring(0,1) == "a") || (s.substring(0,1) == "e") || (s.substring(0,1) == "i") || (s.substring(0,1) == "o") || (s.substring(0,1) == "u") || (s.substring(0,1) == "A") || (s.substring(0,1) == "E") || (s.substring(0,1) == "I") || (s.substring(0,1) == "O") || (s.substring(0,1) == "U") )
return 1 + CountVowels(s.substring(0,1));
else
return 0 + CountVowels(s.substring(0,1));
}Norm_Sea_3 wrote:
I am to write a recursive program that counts the number of vowels in a given String. So far, this is what I haveIf you are looking for a recursive solution then you can use this
public static int CountVowels( String s )
if ( s.length() == 0 )
return 0;
else
char x=charAt(0);
if ( x == "a"|| x == "e" || x == "i" || x == "o" || x == "u" || x == "A" || x == "E" || x == "I" || x == "O"|| x == "U" )
return 1 + CountVowels(s.substring(1,s.length()));
else
return 0 + CountVowels(s.substring(1,s.length()));
}
Maybe you are looking for
-
JTree, displaying data from a database
Hi, im doing an application that will display the listing of courses, and allow users to book them. For the display of courses, i plan to use JTree to display them. However my problem arises from fetchin data and putting them into the tree. This file
-
Can't scroll up and down in Safari
Ever since updating to Safari 6.1 (running on Lion) I've been having problems using the find function (command-f). After I use the find function, Safari either won't let me scroll up and down on the page, or it will let me scroll but the text becomes
-
Hi, I've a join over two tables with about 150 columns. This was never a problem. Now I have two MAXDB databases from two customers (7.6.06.03). In one of them my statement says "output columns too long", running the same application on the second db
-
ITunes, high CPU, cant sync photos to iphone4!
iTunes is hanging/freezing when i try to loade pics to iPhone4, and using 98-100% CPU! HELP!! it stops right before finish! tried 4 times now..
-
I've been able to open Excel files on my Iphone 5 since I got it about 2 weeks ago. However, this morning when I went to open one, it just goes to a screen telling me the title, size, and type of file I'm trying to open. I shut the phone down and r