如何将列表转换为DrRacket中的字符串?例如,如何将'(红黄蓝绿)转换为"红黄蓝绿"?我尝试使用list-> string但这似乎只适用于字符.
我正在尝试在XCode中编写iPhone应用程序的登录过程.问题在于下面的NSString serverOutput.当我使用printf(serverOutput.UTF8String)打印它时; 它向控制台打印"是".但是,当我将serverOutput与"是"进行比较时,它不起作用.任何帮助,将不胜感激.这是我的代码:
- (IBAction) loginButton: (id) sender
{
// TODO: spawn a login thread
indicator.hidden = FALSE;
[indicator startAnimating];
NSString *post =[NSString stringWithFormat:@"username=%@&password=%@",userName.text, password.text];
NSString *hostStr = @"http://10.243.1.184/connectDB.php?";
hostStr = [hostStr stringByAppendingString:post];
NSData *dataURL = [NSData dataWithContentsOfURL: [ NSURL URLWithString: hostStr ]];
NSString *serverOutput = [[NSString alloc] initWithData:dataURL encoding: NSASCIIStringEncoding];
printf(serverOutput.UTF8String);
if([serverOutput isEqualToString:@"Yes"]){
UIAlertView *alertsuccess = [[UIAlertView alloc] initWithTitle:@"Congrats" message:@"You are authorized"
delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alertsuccess show];
[alertsuccess release];
}
else {
UIAlertView *alertsuccess = [[UIAlertView alloc] initWithTitle:@"Error" …Run Code Online (Sandbox Code Playgroud)