Tagged Questions
1
vote
2answers
35 views
In a function prototype it shows an error
it shows cannot find symbol- class string
I am writing a program for a report card. This function is to accept names. Pls help
public static string accept_name() {
String STR[]=new String[40];
...
2
votes
1answer
179 views
Strange looping at end of function body call C++
I am writing a game program in C++ and have encountered an odd problem that seems to be unique to this function.
When this function is called, it executes just as expected all the way through to the ...
1
vote
2answers
40 views
Measure the distance between two strings with Ruby?
Can I measure the distance between two strings with Ruby?
I.e.:
compare('Test', 'est') # Returns 1
compare('Test', 'Tes') # Returns 1
compare('Test', 'Tast') # Returns 1
compare('Test', 'Taste') # ...
0
votes
1answer
15 views
MATLAB function open works in workspace, but not in function
I am trying to create a video file with MATLAB. Here is my function:
function [vidObj] = createVideo(frames, frameRate, filename)
%Create video object
num_frames = size(frames,2);
vidObj = ...
0
votes
2answers
34 views
how do I recall a string from a different function?
I am having trouble calling the string "rlist" from:
public void main()
{
string rlist;
if (radioButton1.Checked)
textBox1.Enabled = false;
...
1
vote
5answers
73 views
How do you find out if the string is a component of the preceding string
I am trying to write a function that will look at a list of strings and determine if the next string in the list is a sub-string of the preceding string.
So if I had a list of ['Ryan', 'Rya', 'Ry', ...
0
votes
0answers
15 views
sql string function not working in asp.net data controll
I am using sql string function in simple query analyzer
select right(book_name,4) from books
it is working on sql database but when I bound it to a repeater or datalist control in asp.net using ...
1
vote
4answers
39 views
Force function argument to be a string
So, my code is like this:
def func(s,x):
return eval(s.replace('x',x)
#Example:
>> func('x**2 + 3*x',1)
4
The first argument of the function func must be a string because the function ...
0
votes
1answer
35 views
String Error in Void Function Segmentation Fault
This is one void function from a larger program, with the function of printing a kind of chart. It would first print the header, and then it uses a for loop to print 13 lines that calls information ...
0
votes
1answer
67 views
Mysql function remove words with less than 3 characters
I have a problem.
In my database i have certain stored procedures that perform a search on keywords i have. In my GUI (in asp.net) i have a function that takes care of my problem, but i need the same ...
0
votes
1answer
27 views
Web Service saving a string value from a function
I was just wondering if a Web Service can save something i send to it as a string without resetting it everytime i call the WS?
<WebMethod()> _
Public Function sendLCDBrightnessLevel(ByRef ...
2
votes
3answers
110 views
Is it bad to have functions return strings instead of ints? (C++)
I'm still relatively new to programming. I'm in the process of working on a game with SDL and I find myself wondering where or not I am using bad habits.
For example, I have a function called ...
0
votes
2answers
53 views
How do I get rid of the “Intellisense: no suitable conversion function from ”std::string“ to ”std::string *“ exists” error?
So here's my code,
#include <iostream>
#include <string>
using namespace std;
int main()
{
const int NUM_NAMES = 20;
string names [NUM_NAMES] = {"Collins, Bill", "Smith, Bart" , "Allen, ...
0
votes
5answers
62 views
Replace all characters of string to asterisks except first and last characters in PHP [duplicate]
How to replace all characters of string to asterisks except first and last characters in PHP?
For example test should become t**t and profanity become p******y and so on
1
vote
2answers
76 views
Python Concatenate String and Function
Is there a way in Python to cat a string and a function?
For example
def myFunction():
a=(str(local_time[0]))
return a
b="MyFunction"+myFunction
I get an error that I cannot concatenate a ...
0
votes
1answer
48 views
jQuery execute string as function
I want to pass in a jQuery command (in the form of a string) from server-side JS to client-side js. This allows me to modify client-side DOM stuff from the server-side.
Function:
...
0
votes
2answers
87 views
VBA function to return array from string input
I wrote a function to do some basic string parsing but for reasons currently unknown to me, my compiler keeps flagging my code for a type mismatch error. The function takes a string, replaces some ...
0
votes
4answers
95 views
Use of string.length + counter variable
i'm new to programming and am currently learning javascript on CodeAcademy. This code below is from a tutorial where the program will search a string to look for a name.The program will loop through ...
0
votes
2answers
30 views
Initial assignment a Char Array using a Function in C
as we know it in C, a string defining is,
char string[] = "Hello World";
That is OK,
But I want to use a function and at initial same up,
I tried those, For example;
char * to_string()
{
...
0
votes
2answers
74 views
Convert string to function in python
I have a string coming from the database. This string is the name of a file .py that is within a module. The structure is this:
files
├── file1.py
├── file2.py
└── __init__.py
The file1.py ...
-1
votes
0answers
50 views
How to write a function in python? [closed]
I'm a beginner hehe..
For example
Write a function unique_words() that takes two arguments: (1) text containing a block of text in the form of a str and(2) lenwords which specify a min word length as ...
0
votes
2answers
60 views
C++ use of strings
I am new to c++ programming I have an assignment the takes the content of a txt file and checks the content with a dictionary txt file. When I send the string[] to my function I always get an error ...
1
vote
4answers
43 views
Load in words, not letters [WordPress/PHP]
I hope someone can help me out.
I'm working on a website where I installed Wordpress. On the frontpage I have a small div where I want to output the first 10 words from another page with pageID.
At ...
0
votes
2answers
54 views
PHP - regex/function to replace the nth ocurrence of a character within a string
I have a SQL query string like this:
SELECT * FROM `oc_product` WHERE `manufacturer_id` = ? AND `date_added` < ? `product_id` IN (?) AND `price` > ? ORDER BY `product_id` ASC;
This is handed ...
1
vote
3answers
78 views
Declaring function returning string in C++
i am trying to declare function returning string in header file because i will call this from objective-c. basically this would work, isn't it?
std::string myFunction();
but it throws error message ...
0
votes
3answers
63 views
function and classes, usage of __str__
I am having some issues concerning the interaction between functions, methods and have a uncertainty of how to utilize the use of the built-in function __str__.
To start this of, I have a class ...
0
votes
2answers
30 views
Data entered alters string length
I am new to JavaScript and I have been doing some work creating a form in HTML and JavaScript. In this work I have been trying to limit the string of a field depending on the text entered into a ...
0
votes
4answers
48 views
function wont return value
$html = ' some html here <br>';
function sql($mysqli,$html){
$stmt = $mysqli->prepare("SELECT * FROM `jobs` WHERE `out` is null");
$stmt->execute();
$stmt->store_result();
...
0
votes
3answers
56 views
Python call a function using a string from users input
In this program I am using a a user input to select which alignment the user wnats to align some text, at present I'm usinf if statements like so...
if alignment == "Left":
line = ...
3
votes
3answers
58 views
Search a word in a string using php function
When i search for "bank", it should display Bank-List1, Bank-List2 from the following list.
Railway-List, Bank-List1, Bank-List2, Education, Ecommerce, Articles, Railway-List1.
Is there is any php ...